Category "matplotlib"

Find and draw regression plane to a set of points

I want to fit a plane to some data points and draw it. My current code is this: import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib.py

Ubuntu running `pip install` gives error 'The following required packages can not be built: * freetype'

When performing pip install -r requirements.txt, I get the following error during the stage where it is installing matplotlib: REQUIRED DEPENDENCIES AND EXTENS

How to prevent the opening of new windows with figures?

When I run a Python script which creates and saves a matplotlib figure, the figure is shown in a new PyCharm window (even if there is no plt.show() in my code).

Seaborn Pariplot: how to move legend and set style

I'm trying to get a pairplot of my data using seaborn. I want to set the legend outside of the axes because my other plots might have upto 9 features which make

How to fix 'numpy.ndarray' object has no attribute 'get_figure' when plotting subplots

I have written the following code to plot 6 pie charts in different subplots, but I get an error. This code works correctly if I use it to plot only 2 charts, b

Is there a way to iteratively add plots to Animation.FuncAnimation()?

I'm working on my master thesis right now and need to animate a high number of points moving. Those points will be representing predators and prey. The number o

Matplotlib mpl_connect not working when placed in subroutine called by Jupyter notebook

I'm working with the Draggable Rectangles example provided in the interactive matplotlib example online: https://matplotlib.org/stable/users/explain/event_handl

Matplotlib and datetime error date2num function AttributeError

I'm trying to plot a graph with a list of datetime objects as one axis. I searched online and it seems I should call the date2num function. However, when I call

matplotlib set shared axis [duplicate]

Using matplotlib, it seems the only time to set the sharex or sharey axis parameters are during sub_plot creation (add_subplot(), subplot(), s

Max Value displayed on matplotlib plot following navigation

I'm trying to return the maximum data value shown on a plot flowing navigation (e.g. pan or zoom). Currently ax.get_ylim(), returns the max value of the y axi

Legend transparency, when using secondary axis

The legend of the plot of a secondary axis somehow is transparent to the plot of the other axis. A minimal example to reproduce the problem: import matplotlib.

Matplotlib Animation of Streamplot of Bifurcation

I am currently trying to animate the dynamics of a typical saddle node bifurcation ode: dx/dt = r + x^2. Snapshots at specific values of r are realised with the

Why does this loop in python runs progressively slower?

In this code, there is a 4-D array of 13x13 images. I would like to save each 13x13 image using matplotlib.pyplot. Here for debugging purposes, I limit the oute

AttributeError: module 'matplotlib.cbook' has no attribute 'iterable'

When I run this code: import networkx as nx G = nx.complete_graph(5) nx.draw_networkx(G) I got this error: AttributeError: module 'matplotlib.cbook' has no a

How to synchronize to curves on matplotlib?

I have two curves that have their maximum roughly at the same time, but I'd like to match them exactly. The first function, maxind, determines where the maximum

Draggable lines select one another in Matplotlib

I'm trying to create a class of draggable lines using matplotlib handling and picking. The aim is to set different thresholds and intervals on a graph. Here is

Cartopy can't download shapefiles because a certificate is not trusted

I need to use cartopy to plot a thing. Running the example from their website import cartopy.crs as ccrs import matplotlib.pyplot as plt ax = plt.axes(projecti

Pyplot Imshow Autozoom to cut out Irregular NaN padding

I have the following code import matplotlib.pyplot as plt import numpy as np array = np.pad(np.random.rand(300,300),10,'constant', constant_values = nan) fi

How to change the datetime tick label frequency for matplotlib plots

Below shows a plot of simulated data, which contains the xticks that I want to modify. By default, the pd.df.plot chooses dates that are approximately 3 months

Tkinter and matplotlib: Bind to FigureCanvasTkAgg to extract curser position in figure?

I want to plot a 2d array using matplotlib, and then extract the curser position when I click on the plotted image. Here's a minimal working example of how I wo