To scatter_density above (you can also take a look at the docstring for The axes as first argument, followed by any arguments you would have passed To use this, initialize the ScatterDensityArtist with ScatterDensityArtist directly (this is used behind the scenes in theĪbove example). If you are a more experienced Matplotlib user, you might want to use the Which produces the following output: ScatterDensityArtist scatter_density ( x, y, color = 'blue' ) ax. scatter_density ( x, y, color = 'red' ) x = np. Here is an example of using the color option: import numpy as np import matplotlib.pyplot as plt import mpl_scatter_density # noqa fig = plt. TheĬolormap will fade to transparent, which means that this mode is ideal when To automatically make a monochromatic colormap based on this color. Set this to 1Ĭolor: this can be set to any valid matplotlib color, and will be used It to None to use the default for the Matplotlib backend you are using.ĭownres_factor: this is an integer that is used to determine how much toĭownsample the density map when panning in interactive mode. By default, this is 72, but you can change it as needed, or set The scatter_density method takes the same options as imshow (for exampleĬmap, alpha, norm, etc.), but also takes the following optionalĭpi: this is an integer that is used to determine the resolution of theĭensity map. add_subplot ( 1, 1, 1, projection = 'scatter_density' ) ax. normal ( 3, 1, N ) # Make the plot - note that for the projection option to work, the # mpl_scatter_density module has to be imported above. import numpy as np import mpl_scatter_density import matplotlib.pyplot as plt # Generate fake data N = 10000000 x = np. Scatter_density method in addition to all the usual methods ( scatter, This will return a ScatterDensityAxes instance that has a Projection='scatter_density' option (if your reaction is ‘wait, what?’, see Then create Matplotlib axes as usual but adding a The easiest way to use this package is to simply import mpl_scatter_density, There are two main ways to use mpl-scatter-density, both of which are Both Python 2.7 and Python 3.x are supported,Īnd the package should work correctly on Linux, MacOS X, and Windows. This package requires Numpy, Matplotlib, and fast-histogram - these will be installedīy pip if they are missing. To install, simply do: pip install mpl-scatter-density Responsive (though this is customizable). When panning, the density map is shown at a lower resolution to keep things Points (and more if you have enough RAM). Million points, but interactive performance is still good even with 100 million The following animation shows real-time interactive use with 10 To make your own scatter density maps, both for interactive and non-interactive The mpl-scatter-density mini-package provides functionality to make it easy
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |