Clearplot Documentation

Clearplot Documentation

Release 1.2.2 Benjamin Reedlunn

Mar 06, 2023

Contents

1 Contents

3

1.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1.3 clearplot package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

1.4 Version History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

2 Primary Features

69

3 Bug Fixes

71

4 Feature Requests and Enhancements

73

5 Potential Improvements

75

Python Module Index

77

Index

79

i

ii

Clearplot Documentation, Release 1.2.2 Clearplot creates publication quality plots using matplotlib. The project began as an effort to create lucid plots with a certain style, like the example below.

Over time, we have also revamped matplotlib's user interface, and added a few new features. Although the documentation has detailed descriptions of the clearplot syntax, probably the best way to get started is to look at the examples.

Contents

1

Clearplot Documentation, Release 1.2.2

2

Contents

1 CHAPTER

Contents

1.1 Installation

1.1.1 Easy Way

1. Install clearplot using pip install -v clearplot from the command line. a. This will download clearplot from PyPI, install it on your PYTHONPATH, and install the custom fonts in the proper directory. The -v tells pip to be verbose, so you can see what pip is doing. b. If pip has trouble connecting to the PyPI server, you can download clearplot from PyPI's website and run pip install -v [path], where [path] is the path to the downloaded tarball.

1.1.2 Hard (Manual) Way

1. Get a recent copy of clearplot using git clone . 2. Append the clearplot directory to your PYTHONPATH. 3. Load a python interpreter. Verify that you can run import clearplot without any errors. 4. Place the custom fonts where matplotlib can find them.

a. Find where Matplotlib stores its True Type fonts. In a python interpreter, type the following two commands: import matplotlib, matplotlib.matplotlib_fname(). On a mac, you should get something like .../site-packages/matplotlib/mpl-data/matplotlibrc. The True Type fonts are stored in .../site-packages/matplotlib/mpl-data/fonts/ttf/.

b. Grab the fonts in the directories inside clearplot/Font_Files/ and place them in: .../ python3.8/site-packages/matplotlib/mpl-data/fonts/ttf/.

c. Find where Matplotlib stores its cache files. In a python interpreter, enter matplotlib. get_cachedir(). On a mac, you should get something like /Users/[username]/. matplotlib.

3

Clearplot Documentation, Release 1.2.2

d. Go to /Users/[username]/.matplotlib and delete fontList.cache. Next time matplotlib is imported the cache file will be rebuilt.

e. If you run into trouble, or want more information, see this post.

1.1.3 Optional Additional Steps

1. If you are using the Spyder IDE on a Mac, you may need to change the matplotlib backend loaded by Spyder's scientific startup script. The MacOSX backend and the TkAgg backend both have issues (see this post and this post for more information). If you are running into these problems, you must:

a. Go to Spyder Preferences->Console->External Modules and set the GUI Backend to Qt4Agg. b. Go to Spyder Preferences->Console->Advanced Settings and select "Use the following startup script" to select

the scientific_startup.py script. c. Restart Spyder. 2. Install the custom fonts on your system so they can be accessed by other applications like Adobe Illustrator and

Inkscape. a. Find where Matplotlib stores its True Type fonts. In a python interpreter, type the following two commands: import matplotlib, matplotlib.matplotlib_fname(). On a mac you should get something like: .../site-packages/matplotlib/mpl-data/matplotlibrc. The custom fonts, such as TeXGyreHeros-txfonts, should have been installed in .../site-packages/ matplotlib/mpl-data/fonts/ttf/.

b. For Adobe Illustrator on a Mac, you can simply open the Font Book application (/Applications/ Utilities/Font Book) and "drag and drop" the font files into the Font Book window.

c. For Inkscape on a Mac, you must copy the font files into the main font folder, not the user font folder. The main font folder is located at /Library/Fonts.

d. I do not know how to install fonts on Windows or Linux, but I am sure there are instructions online.

1.2 Examples

These examples serve to showcase clearplot's capabilities, help new users get clearplot's syntax right, and verify that clearplot is working correctly. Click on any image to see full size image and source code.

1.2.1 Barebones

Default everything.

import clearplot.plot_functions as pf import numpy as np

x = np.arange(0,10,0.01) y = np.sqrt(x) pf.plot('bare_bones.png', x, y);

4

Chapter 1. Contents

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download