From 8ca648dc0658b9cfc2e1bb4bdadfe4f587a013ab Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson <oscar.gustafsson@gmail.com> Date: Mon, 26 Aug 2024 15:45:44 +0200 Subject: [PATCH] Fix equation font and add install instructions --- README.md | 48 ++++++++++++++++++++----- matplotlib/src/liucolors/slide.mplstyle | 5 +-- 2 files changed, 43 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index ad7ebfe..fa29fc1 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,11 @@ Click on the small arrow to the right of the color bar and select one of the fol  ### GIMP + The Inkscape palettes are in GIMP format so it is possible to use them for GIMP as well. See https://docs.gimp.org/en/gimp-palette-dialog.html for more information how to import the palettes. ## LibreOffice + Copy the contents of the `libreoffice` folder to your config folder, which is located at `~/.config/libreoffice/4/user/config` on Linux/OS X or `C:\Users\MY USERNAME\AppData\Roaming\LibreOffice\4\user\config` on Windows, where 4 may be a different number based on the first version of LibreOffice that you used. If LibreOffice is open, restart. Note that `AppData` is a hidden directory, so you may have to type it. You will get an extra option in the color drop down with the name `liubeamer`, see: @@ -37,36 +39,52 @@ You will get an extra option in the color drop down with the name `liubeamer`, s Copy the `matlab` folder and use `addpath` to add it to your Matlab path and, optionally, `savepath` to avoid the need of adding every time you start a new session. -#### Commands: +### Commands + - `liucolors`: defines a number of variables with the same names and color definitions as the Beamer LaTeX template, use with the `'color'` optional argument in e.g. `plot` - `liulines`: color map, primarily for use with the `colororder` command, to get automatic LiU colors on the lines - `liumap`: tinted color map based on the blue LiU color, primarily to be used with the `colormap` command, where number of steps and range can be controlled -#### Examples -``` +### Examples + +``` matlab colormap(liumap) surf(peaks) ``` +  -``` + +``` matlab colororder(liulines) plot(repmat(1:7, 10, 1) + rand(7,10)') ``` +  -``` +``` matlab liucolors plot(sin(linspace(0,2*pi,1000)), 'color', LiUblue) ``` +  ## Matplotlib -Copy `matplotlib/liucolors.py` to a directory in your `PYTHON_PATH` or in the same directory as you are creating your code. You can now import the color maps using e.g. `from liucolors import *`. Use the color map by using the `cmap` optional argument. Available color maps with names are shown below. Think twice, at least, before using `liucontinuouscomplement`. + +To install the package: +``` bash +cd matplotlib +python -m pip install . +``` + +This will install the package `liucolors`. + +Use the color map by using the `cmap` optional argument. Available color maps with names are shown below. Think twice, at least, before using `liucontinuouscomplement`.  To use specific colors, there is a dictionary `liubeamercolor` which includes all the colors defined in the LiU Beamer template. An example is -``` + +``` python import matplotlib.pyplot as plt from liucolors import liubeamercolor @@ -74,9 +92,23 @@ plt.plot([1, 2, 3], [2, 5, 3], color=liubeamercolor["LiUblue"]) ``` There is also a SimpleNamespace class `liucolors` which has the colors above as members, without the `LiU`-prefix. This allows easier completion in editors. -``` + +``` python import matplotlib.pyplot as plt from liucolors import liucolors plt.plot([1, 2, 3], [2, 5, 3], color=liucolors.blue) ``` + +Finally, there is a style-file setting up colors and fonts, suitable for inclusion in slides or posters. The following is an example of how to use it: + +``` python +import matplotlib.pyplot as plt +import matplotlib as mpl + +with mpl.style.context("liucolors.slide"): + fig, ax = plt.subplots() + ax.plot([1, 2, 3], [2, 5, 3]) +``` + +Note that the figure size is set to fit on a slide, so for poster use you may want to set a different figure size. diff --git a/matplotlib/src/liucolors/slide.mplstyle b/matplotlib/src/liucolors/slide.mplstyle index 9ca5c1d..d1364b8 100644 --- a/matplotlib/src/liucolors/slide.mplstyle +++ b/matplotlib/src/liucolors/slide.mplstyle @@ -3,5 +3,6 @@ font.sans-serif : Korolev-LiU, Calibri, DejaVu Sans, Bitstream Vera Sans, Comput font.family : serif font.size : 11.0 lines.linewidth : 3 -axes.prop_cycle: cycler('color', ['00b9e7', 'ff6442', '17c7d2', '8981d3', '00cfb5', 'fdef5d', '6a7e91']) -figure.figsize: 5.5, 2.5 +axes.prop_cycle : cycler('color', ['00b9e7', 'ff6442', '17c7d2', '8981d3', '00cfb5', 'fdef5d', '6a7e91']) +figure.figsize : 5.5, 2.5 +mathtext.fontset : cm -- GitLab