Saravanan666/pypi-org huggingface dataset:
Package: matplotlib
Matplotlib is a comprehensive library for creating static, animated, and
interactive visualizations in Python.Check out ourhome pagefor more information.Matplotlib produces publication-quality figures in a variety of hardcopy
formats and interactive environments across platforms. Matplotlib can be
used in Python scripts, Python/IPython shells, web application servers,
and various graphical user interface toolkits.InstallSee theinstall
documentation,
which is generated from/doc/users/installing/index.rstContributeYou've discovered a bug or something else you want to change — excellent!You've worked out a way to fix it — even better!You want to tell us about it — best of all!Start at thecontributing
guide!ContactDiscourseis the discussion forum
for general questions and discussions and our recommended starting
point.Our active mailing lists (which are mirrored on Discourse) are:Usersmailing list:matplotlib-users@python.orgAnnouncementmailing list:matplotlib-announce@python.orgDevelopmentmailing list:matplotlib-devel@python.orgGitteris for coordinating
development and asking questions directly related to contributing to
matplotlib.Citing MatplotlibIf Matplotlib contributes to a project that leads to publication, please
acknowledge this by citing Matplotlib.A ready-made citation
entryis
available.
Package: matplotlib-ai
Do you also have a love-hate relationship with matplotlib? So do I!
That’s why I created this mini-project that can help you graph your data using natural language.
The package dependencies require openai and matplotlib, and it is unbelievably easy to use.
Calling OpenAI’s GPT API, prompt engineering, and using few-shot learning, matplotlib_ai is capable
of generating graphs without requiring you to write a single line of matplotlib code! Check out this GitHub link:https://github.com/notY0rick/matplotlib_ai
Package: matplotlib-arm64
Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python.
Precompiled wheels for matplatlib for arch64. Full credits goes to original authors.Check out ourhome pagefor more information.Matplotlib produces publication-quality figures in a variety of hardcopy formats
and interactive environments across platforms. Matplotlib can be used in Python scripts,
the Python and IPython shell, web application servers, and various
graphical user interface toolkits.InstallFor installation instructions and requirements, seeINSTALL.rstor theinstalldocumentation.TestAfter installation, launch the test suite:python -m pytestRead thetesting guidefor more information and alternatives.ContributeYou’ve discovered a bug or something else you want to change - excellent!You’ve worked out a way to fix it – even better!You want to tell us about it – best of all!Start at thecontributing guide!ContactDiscourseis the discussion forum for general questions and discussions and our recommended starting point.Our active mailing lists (which are mirrored on Discourse) are:Usersmailing list:matplotlib-users@python.orgAnnouncementmailing list:matplotlib-announce@python.orgDevelopmentmailing list:matplotlib-devel@python.orgGitteris for coordinating development and asking questions directly related
to contributing to matplotlib.Citing MatplotlibIf Matplotlib contributes to a project that leads to publication, please
acknowledge this by citing Matplotlib.A ready-made citation entryis available.
Package: matplotlib-aximgcache
Easily store and replot matplotlib Axes contentHave a plot that takes a long time to create and which you want to overlay
different things onto? You can usematplotlib-aximgcacheto save the
intermediate axes content to an image and later replot that same content into a
new axes (in the right place with transparency!) All you need is.save_ax_to_imageand.load_and_plot_image, see below for an example (orexample.ipynb).Installationpython -m pip install matplotlib-aximgcacheUsageFirst, we'll create a reference plot with some shapes that extend to the edges
of the figure and with whitespace in the middle so that we can test that
transparency works. At the end we call.save_ax_to_image(...)to save thematplotlib.Axescontent.importmatplotlib.pyplotaspltimportmatplotlib.patchesasmpatchesimportmatplotlib_aximgcacheasmpl_aicfig,ax=plt.subplots()ax.set_xlim(0,400)ax.set_ylim(0,200)rects=[mpatches.Rectangle((0,0),100,200,linewidth=1,edgecolor="none",facecolor="b"),mpatches.Rectangle((400,0),-100,200,linewidth=1,edgecolor="none",facecolor="b"),mpatches.Rectangle((50,50),100,100,linewidth=1,edgecolor="g",facecolor="r"),mpatches.Rectangle((250,50),100,100,linewidth=1,edgecolor="g",facecolor="r"),]forrectinrects:ax.add_patch(rect)# save the content of the axes to a PNG-image so that it can be replotted# into a new axes latermpl_aic.save_ax_to_image(ax=ax,fpath="test.png")The figure looks like this:The stored image looks this (and contains meta-info so we can replot it in the
correct location):Next, we create a new figure with an axes that has different extents than the
original axes and has some extra content (a few green rectangles) so we can
check alignment and transparency:fig,ax=plt.subplots(figsize=(8,8))ax.set_xlim(-200,500)ax.set_ylim(-200,400)# add a few green rectangles to show that with changed axes extents# the loaded image is plotted in the correct place and has transparencyrect=mpatches.Rectangle((100,0),20,300,linewidth=1,edgecolor="none",facecolor="g")ax.add_patch(rect)rect=mpatches.Rectangle((300,0),-20,300,linewidth=1,edgecolor="none",facecolor="g",zorder=2)ax.add_patch(rect)# add the content of the previous figure's axes from the image stored above# note that the loaded content is plotted with `zorder=1`, you can change# this if you want to change the z-ordering relative to other things in your# new figurempl_aic.load_and_plot_image(ax=ax,fpath="test.png")The final figure looks like this:NB: as you can tell from the above image there is a slight offset issue with
the plotted image. If you know what that might beplease let me
know!Contributing and inspirationI got the technique for saving the axes content fromImportantOfBeingErneston stackoverflow.Pull-request welcome!
Package: matplotlib-backend-kitty
matplotlib-backend-kittyThis python module allows you to use yourkitty terminalto show the plots generated by python'smatplotlib.For other terminals, the similarnotcurses backendmay also be of interest.To install this one, do one of the following$ pip install --user matplotlib-backend-kittyclone this repo into your python'ssite-packagesdirectoryclone this repo and add the parent directory tosys.pathor$PYTHONPATHThen, configure matplotlib to use the module by either setting the
environment variableMPLBACKENDtomodule://matplotlib-backend-kittyor by initializing matplotlib as follows.importmatplotlibmatplotlib.use('module://matplotlib-backend-kitty')importmatplotlib.pyplotaspltIf you've installed this module correctly, you can now use
the following sample code to draw a plot in your terminal.$ export MPLBACKEND='module://matplotlib-backend-kitty'
$ python -i
>>> n = 10000
>>> df = pd.DataFrame({'x': np.random.randn(n),
                       'y': np.random.randn(n)})
>>> df.plot.hexbin(x='x', y='y', gridsize=20)
<plot is shown>If you set your matplotlib to interactive mode viamatplotlib.pyplot.ion()or by running python aspython -i, non-empty figures are drawn on construction
where possible. This allows you to use pandas'plot()calls directly, without callingplt.show(), and still
enables you to manually construct andplt.show().If your matplotlib is in non-interactive mode,
you can construct your figures as usual, and then callplt.show()to render them to your terminal. This
works from both a repl and when running scripts.Figures are resized to the size of your terminal by default.
If you'd rather control the sizing of figures manually,
set theMPLBACKEND_KITTY_SIZINGenvironment variable tomanual.Internally, this backend is somewhat based on matplotlib's
IPython support: it's a hybrid of image and GUI backend types.
It works by using matplotlib'sAggbackend to render the
plot, and then calls kitty'sicatto place the rendered
image on your terminal. This means that plotting works as
expected, but the image drawn to your terminal isn't
interactive and animations aren't supported.
Package: matplotlib-backend-notcurses
matplotlib-backend-notcursesThis python module allows you to show the plots generated
by python'smatplotlibin many modern and older terminals by usingnotcurses.To install it, you will need to do one of the following$ pip install --user matplotlib-backend-notcursesclone this repo into your python'ssite-packagesdirectoryclone this repo and add the parent directory tosys.pathor$PYTHONPATHThen, configure matplotlib to use the module by either setting the
environment variableMPLBACKENDtomodule://matplotlib-backend-notcursesor by initializing matplotlib as follows.importmatplotlibmatplotlib.use('module://matplotlib-backend-notcurses')importmatplotlib.pyplotaspltPlease make sure that you have the programsncplayerandnotcurses-info, both fromnotcurses, in yourPATH.If you've installed this module correctly, you can now use
the following sample code to draw a plot in your terminal.$ export MPLBACKEND='module://matplotlib-backend-notcurses'
$ python -i
>>> import numpy as np; import pandas as pd
>>> n = 10000
>>> df = pd.DataFrame({'x': np.random.randn(n),
                       'y': np.random.randn(n)})
>>> df.plot.hexbin(x='x', y='y', gridsize=20)
<plot is shown>If you set your matplotlib to interactive mode viamatplotlib.pyplot.ion()or by running python aspython -i, non-empty figures are drawn on construction
where possible. This allows you to use pandas'plot()calls directly, without callingplt.show(), and still
enables you to manually construct andplt.show().If your matplotlib is in non-interactive mode,
you can construct your figures as usual, and then callplt.show()to render them to your terminal. This
works from both a repl and when running scripts.Figures are resized to the size of your terminal by default.
If you'd rather control the sizing of figures manually,
set theMPLBACKEND_NOTCURSES_SIZINGenvironment variable tomanual.Internally, this backend is somewhat based on matplotlib's
IPython support: it's a hybrid of image and GUI backend types.
It works by using matplotlib'sAggbackend to render the
plot, and then calls notcurses'sncplayerto place the rendered
image on your terminal. This means that plotting works as
expected, but the image drawn to your terminal isn't
interactive and animations aren't supported.This is a port of my matplotlib-backend-kitty to notcurses
tooling, which provides support for more terminal graphics
protocols and reasonable auto-detection and fallbacks for these.
Package: matplotlib-backend-qtquick
matplotlib_backend_qtquickThis package implements a QtQuick backend for matplotlib. It started frommaplotlib_qtquick_playground, written by Frédéric Collonval, but it has been updated to work with the current version (3.2.1) of matplotlib.UsageIn order to use matplotlib plots with QtQuick, do the following:In your main.py, useQtQml.qmlRegisterTypeto registerFigureCanvasQtQuickAggunder whichever name you want to use.In your QML files, instantiate an object with the QML type defined above. ItsobjectNameproperty specifies the name of the object that can be found in the QML engine. It can be retrieved in python withwin.findChild(QtCore.QObject, "spectFigure"), for example, where"spectFigure"is theobjectNamein this case.One can then pass this object as needed. This is the FigureCanvasQtQuickAgg object. The figure can be found in itsfigureproperty.For interactive plots, if you want to use the toolbar, to theBridgeclass add slots like:@QtCore.Slot()defzoom(self,*args):"""activate zoom tool."""self.toolbar.zoom(*args)One can also connect to Matplotlib events:self._figure.canvas.mpl_connect('button_press_event',self.onClick)self._figure.canvas.mpl_connect('scroll_event',self.onScroll)and provide the callbacks, for example:defonClick(self,event):"""Handle mouse clicks in the three slices:set the slice to what is clicked."""ifevent.button==MouseButton.LEFT:ifevent.inaxes==self.axeses[0]:self.x=self._findBin(self.xAxis,event.xdata)self.y=self._findBin(self.yAxis,event.ydata)self.setSlice()elifevent.inaxes==self.axeses[1]:self.x=self._findBin(self.xAxis,event.xdata)self.z=self._findBin(self.zAxis,event.ydata)self.setSlice()elifevent.inaxes==self.axeses[2]:self.y=self._findBin(self.yAxis,event.xdata)self.z=self._findBin(self.zAxis,event.ydata)self.setSlice()defonScroll(self,event):"""Handle mouse scroll in the three slices- scroll the independent variable"""ifevent.inaxes==self.axeses[0]:self.z+=int(event.step)self.setSlice()elifevent.inaxes==self.axeses[1]:self.y+=int(event.step)self.setSlice()elifevent.inaxes==self.axeses[2]:self.x+=int(event.step)self.setSlice()Please let me know if you have any suggestions or better ways I should do this.ExamplesThe example in theexamplesdirectory gives a simple example of how to use this backend, including interactions.
Package: matplotlib-backend-sixel
matplotlib-backend-sixelThis python module allows you to use yoursixel-enabled terminalto show inline plots generated by python'smatplotlib.The module is a modified version of thekitty backendand is also based on this
earliersixel backend.You will need a terminal that has support for the SIXEL graphics format andimagemagickinstalled.To install either run$ pip install --user matplotlib-backend-sixelor clone this repo and run$cd matplotlib-backend-sixel && pip install .Configure matplotlib to use the module by either setting the
environment variableMPLBACKENDtomodule://matplotlib-backend-sixelor by initializing matplotlib as follows.importmatplotlibmatplotlib.use('module://matplotlib-backend-sixel')importmatplotlib.pyplotaspltIf you've installed this module correctly, you can now use
the following sample code to draw a plot in your terminal.$ ipython
In [1]: import matplotlib
   ...: matplotlib.use('module://matplotlib-backend-sixel')
   ...: import numpy as np
   ...: import matplotlib.pyplot as plt
   ...: plt.style.use("dark_background")
   ...: t = np.linspace(0,5,200)
   ...: plt.fill_between(t,np.sin(t),np.cos(2*t),alpha=0.5)
   ...: plt.fill_between(t,np.cos(t),np.sin(2*t),alpha=0.5)
   ...: plt.show()

<plot is shown>If you set your matplotlib to interactive mode viamatplotlib.pyplot.ion()or by running python aspython -i, non-empty figures are drawn on construction
where possible. This allows you to use pandas'plot()calls directly, without callingplt.show(), and still
enables you to manually construct andplt.show().If your matplotlib is in non-interactive mode,
you can construct your figures as usual, and then callplt.show()to render them to your terminal. This
works from both a repl and when running scripts.Internally, this backend is somewhat based on matplotlib's
IPython support: it's a hybrid of image and GUI backend types.
It works by using matplotlib'sAggbackend to render the
plot, and then callsimagemagickto convert to sixel format
and then cat the image to your terminal. This means that plotting works as
expected, but the image drawn to your terminal isn't
interactive and animations aren't supported.
Package: matplotlib-backend-wezterm
matplotlib-backend-weztermThis python module allows you to use yourwezterm terminalto show the plots generated by python'smatplotlib.For other terminals, the similarnotcurses backendmay also be of interest.To install this one, do one of the following$ pip install --user matplotlib-backend-weztermclone this repo into your python'ssite-packagesdirectoryclone this repo and add the parent directory tosys.pathor$PYTHONPATHThen, configure matplotlib to use the module by either setting the
environment variableMPLBACKENDtomodule://matplotlib-backend-weztermor by initializing matplotlib as follows.importmatplotlibmatplotlib.use('module://matplotlib-backend-wezterm')importmatplotlib.pyplotaspltIf you've installed this module correctly, you can now use
the following sample code to draw a plot in your terminal.$ export MPLBACKEND='module://matplotlib-backend-wezterm'
$ python -i
>>> n = 10000
>>> df = pd.DataFrame({'x': np.random.randn(n),
                       'y': np.random.randn(n)})
>>> df.plot.hexbin(x='x', y='y', gridsize=20)
<plot is shown>If you set your matplotlib to interactive mode viamatplotlib.pyplot.ion()or by running python aspython -i, non-empty figures are drawn on construction
where possible. This allows you to use pandas'plot()calls directly, without callingplt.show(), and still
enables you to manually construct andplt.show().If your matplotlib is in non-interactive mode,
you can construct your figures as usual, and then callplt.show()to render them to your terminal. This
works from both a repl and when running scripts.You can use the environment variableMPLBACKEND_TRANSPARENT=1to
control the plot's background.Internally, this backend is somewhat based on matplotlib's
IPython support: it's a hybrid of image and GUI backend types.
It works by using matplotlib'sAggbackend to render the
plot, and then calls wezterm'simgcatto place the rendered
image on your terminal. This means that plotting works as
expected, but the image drawn to your terminal isn't
interactive and animations aren't supported.
Package: matplotlib-colors
Matplotlib ColorsA collection of curated colors and colormaps for matplotlib.Installationpipinstallmatplotlib-colorsDemoAll colors and colormapsExamplesColormapsCall theregister_cmapsfunction to add the new colormaps to matplotlib. Then the desired colormap can be specified by name as thecmapargument.frommatplotlib_colorsimportregister_cmapsregister_cmaps()# Adds new colormaps to matplotlib# Build your data viz as normal with matplotlibimportnumpyasnpimportmatplotlib.pyplotaspltx=[1,2,3,4,5,6,7,8,9,10,11,12]y=[x*xforxinx]plt.scatter(x,y,c=range(12),cmap='analyst')# Specify one of the new colormap namesplt.colorbar()plt.show()Alternatively, all new colormap objects can be accessed directly by importing thecolormapsdict and specifying a colormap by name.importnumpyasnpimportmatplotlib.pyplotaspltfrommatplotlib_colorsimportcolormapsx=[1,2,3,4,5,6,7,8,9,10,11,12]y=[x*xforxinx]plt.scatter(x,y,c=range(12),cmap=colormaps['analyst'])# Specify a colormap from colormaps dictplt.colorbar()plt.show()The full list of colormap names can be found by importing thecolormap_nameslist.frommatplotlib_colorsimportcolormap_namesColorsThe package includes a large selection of colors that can be accessed directly by importingcolorsand specifying a color name.importmatplotlib.pyplotaspltfrommatplotlib_colorsimportcolorsx=[1,2,3,4,5,6,7,8,9,10,11,12]y=[x*xforxinx]plt.scatter(x,y,c=colors['PL_RED'])# All points colored with PL_REDplt.colorbar()plt.show()The full list of color names can be found by importing thecolor_nameslist.frommatplotlib_colorsimportcolor_names
Package: matplotlib-dashboard
Matplotlib Dashboard PackageThis package creates a simple user interface for creating subfigures when working with matplotlib.importmatplotlib.pyplotaspltplt.figure(figsize=(10,10))frommatplotlib_dashboardimportMatplotlibDashboarddashboard=MatplotlibDashboard([['top','top','top','top'],['left','left',None,'right'],['left','left','down','right'],],as3D=['left'],wspace=0.5,hspace=0.5)importnumpyasnpdashboard['top'].plot(np.random.rand(200),color='red')dashboard['top'].set_ylabel('y')dashboard['top'].set_xlabel('x')dashboard['top'].set_title('top plot')dashboard['right'].bar(['A','B','C'],[10,35,17],color='blue')dashboard['right'].set_ylabel('freq')dashboard['right'].set_xlabel('label')dashboard['right'].set_title('right bar')fromPILimportImagedashboard['down'].imshow(Image.open('./test1.jpeg'))dashboard['down'].get_xaxis().set_ticks([])dashboard['down'].get_yaxis().set_ticks([])dashboard['down'].set_title('down image')z=((5-np.arange(100)%10)**3).reshape(10,10)x,y=np.meshgrid(np.arange(z.shape[0]),np.arange(z.shape[1]))dashboard['left'].plot_surface(x,y,z,color='green')dashboard['left'].set_ylabel('x')dashboard['left'].set_xlabel('y')dashboard['left'].set_zlabel('z')dashboard['left'].set_title('left surface')plt.show()CustomizationPass the map of subfigures you want when getting an instance of the dashboard. Write the map as a list of lists or a 2D array.Get the subfigure you want using get-item syntax. The name is what you defined in the map.Use theNonekeyword to access the empty part of the map.Useas3Dargument to determine which subfigures are 3D.Any customization onmatplotlib.pyplotalso applies to this dashboard. For example, useplt.figure(figsize=(x,y))to change the size of the dashboard figure.This module is based onmatplotlib.gridspec. Therefore, you can use thegridspecinitialization configurable parameters with the same functionality in this dashboard initialization. For example, set thewspaceandhspaceparameters to change the horizontal or vertical spacing between subfigures.Installationpip install matplotlib-dashboard
Package: matplotlib-extract
matplotlib-extractThis package is useful to create dynamic presentations where elements of a plot appear one by one. To do so, the elements are exported to seperate files.Install withpip install matplotlib-extractUsageimportmatplotlib.pyplotaspltfrommatplotlib_extractimportextract_elementsimportnumpyasnpx=np.linspace(0,2*np.pi)y1=2*xy2=6+2*np.sin(x)plt.plot(x,y1,label="line1")plt.plot(x,y2,label="line2")plt.legend()extract_elements()plt.show()Running this script will create files for the lines, the axis and the legend.
Package: matplotlib-fontja
matplotlib-fontjamatplotlibを日本語表示に対応させます。uehara1414さんのjapanize-matplotlibをフォークし、Python 3.12以降でも動作するよう修正したものです。変更点の詳細についてはCHANGELOGをお読みください。利用方法matplotlibをimportした後、matplotlib_fontjaをimportします。importmatplotlib.pyplotaspltimportmatplotlib_fontjaplt.plot([1,2,3,4])plt.xlabel('簡単なグラフ')plt.show()インストール# pipを使う場合pipinstallmatplotlib-fontja# Pipenvを使う場合pipenvinstallmatplotlib-fontja# Poetryを使う場合poetryaddmatplotlib-fontja# Ryeを使う場合ryeaddmatplotlib-fontja
ryesync利用フォントIPAexゴシック (Ver.004.01) を利用しています。
利用にあたってはIPAフォントライセンスv1.0に同意してください。FAQimport matplotlib_fontjaしたのに日本語表示になりません#1import matplotlib_fontjaしてからmatplotlibでグラフを描画するまでにフォントの設定が変わる処理が入っていると、日本語表示がなされない可能性があります。例えば、seabornを利用している場合であればsns.set()などで描画フォントが seaborn のデフォルトに上書きされ、日本語表示がされなくなります。sns.set(font="IPAexGothic")のように利用フォントにIPAexGothicを設定するか、フォント上書き後にmatplotlib_fontja.japanize()を利用するなどで日本語表示できるはずです。importのみして利用されないコードなのでフォーマッターに消されてしまいますリンターなどの警告が気になる・コードを消される方向けにmatplotlib_fontja.japanize()メソッドの実行でもimport時と同じくフォントを設定できるようになっています。
無意味な実行になりますが、時と場合に応じて実行してください。もしくはリンターごとに無視させる設定をすることで対応できるはずです。# noqaなどで設定してください。なぜインストール時はmatplotlib-fontjaでimport時はmatplotlib_fontjaなのですか？チェインケースが読みやすく好きだからです。import時にはチェインケースは利用できないのでスネークケースになっています。