Category "matplotlib"

Having a colorbar for a bar plot in python

Hi I don't know if this is possible, but I have made a bar plot in python where the color is a hex value. If I have the value that a hex code corresponds to, i

Having a colorbar for a bar plot in python

Hi I don't know if this is possible, but I have made a bar plot in python where the color is a hex value. If I have the value that a hex code corresponds to, i

matplotlib: 2 different legends on same graph

I have a plot where different colors are used for different parameters, and where different line styles are used for different algorithms. The goal is to compar

Centering matplotlib legend entries within incomplete/unfilled rows?

Say I'm making a plot with five items, and only have room to create a legend with 3 columns (more columns than this would be too wide), e.g. import matplotlib.p

How to force color mapping to a dynamic range larger than the particular input to imshow in matplotlib

Suppose I want to make 2+ heatmaps (on the same, or different Figures) and have the color<->value mapping be the same among them. By default, the extre

Is there a way to plot multiple horizontal lines using hlines() function in a single plot of matplotlib?

I have an pm2_5 dataframe data which I've plotted using a matplotlib scatterplot. I want to insert multiple horizontal lines at different y-values, I'm doing it

How to display a text with matplotlib

I would like to do this : I have this python code : import numpy as np import pylab as plt a = np.array([1,2,3,4,5,6,7,8,9,10]) b = np.array([7,8,6,3,2,1,5,8,4

How to scale Seaborn's y-axis with a bar plot

I'm using factorplot(kind="bar"). How do I scale the y-axis, for example with log-scale? I tried tinkering with the plots' axes, but that always messed up the b

align a cartopy 2D map plot with a 1D line plot

I need to align a cartopy 2D map subplot with a 1D line subplot, using the following code: import xarray as xr import cartopy.crs as ccrs import matplotlib.pyp

matplotlib funcanimation update function is called twice for first argument

Going through some tutorials on matplotlib animations and encountered this problem. I am using the matplotlib.animation funcanimation as follows: import matplo

How can I exponentially scale the Y axis with matplotlib

I'm trying to create a matplotlib plot with an exponential(?) Y axis like the fake one I've mocked up below. For my data I want to spread the values out as they

Getting individual colors from a color map in matplotlib

If you have a Colormap cmap, for example: cmap = matplotlib.cm.get_cmap('Spectral') How can you get a particular colour out of it between 0 and 1, where 0 is t

Matplotlib chart does not display in PyCharm

I run the following code in PyCharm 3.4.1, and it highlighted %matplotlib inline showing syntax error, and I delete the first line, and run, I expect it will pr

Keras - Plot training, validation and test set accuracy

I want to plot the output of this simple neural network: model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) history = model.fit

Matplotlib in C++

I would like to use matplotlib to plot an x,y graph. To do this, I downloaded "matplotlibcpp.h" from github : https://github.com/lava/matplotlib-cpp However, in

Connecting means in seaborn box plot

I want to connect box plot means. I can do the basic part but cannot connect box plot means and box plots offset from x axis. similar post but not connecting me

Plot 3D Cube and Draw Line on 3D in Python

I know, for those who know Python well piece of cake a question. I have an excel file and it looks like this: 1 7 5 8 2 4 6 3 1 7 4 6 8

Plot 3D Cube and Draw Line on 3D in Python

I know, for those who know Python well piece of cake a question. I have an excel file and it looks like this: 1 7 5 8 2 4 6 3 1 7 4 6 8

Import "matplotlib" could not be resolved from source Pylance(reportMissingModuleSource)

whenever I try to import matplotlib or matplotlib.pyplot in VS Code I get the error in the title: Import "matplotlib" could not be resolved from source Pylance(

How can I rotate a matplotlib plot through 90 degrees?

I have created a figure in matplotlib which contains three subplots, one in the top left quadrant, one in the top right quadrant, and one in the bottom right qu