Category "matplotlib"

Python Matplotlib - imshow but with hexagons

Code is: import numpy as np import matplotlib.pyplot as plt from matplotlib import colors example_data = np.random.randint(4, size=(40,44)) cmap = colors.List

how to extract a subset of a colormap as a new colormap in matplotlib?

I would like to use a colormap from matplotlib e.g. CMRmap. But I don't want to use the "black" color at the beginning and the "white" color at the end. I'm int

How to change the text color of font in legend?

Is there a way to change the font color of the legend in a matplotlib plot? Specially in occasions where the background of the plot is dark, the default black t

Drop down menu for the graph

I am new to python and I'm trying to make a drop down menu for this graph that shows temperatures at different times of day.The datas are imported from a csv fi

Plt.show shows full graph but savefig is cropping the image

My code is succesfully saving images to file, but it is cropping important details from the right hand side. Answers exist for fixing this problem when it arise

Exception thrown in PyCharm debug mode but not in run mode (seaborn, matplotlib)

I'm using PyCharm 2021.2.3 Community Edition Python interpreter 3.10.0 matplotlib 3.5.0 seaborn 0.11.2 numpy 1.21.4 pandas 1.3.4 PySimpleGUI 4.55.1 When I run t

How to show the y-axis of seaborn displot as percentage

I'm using seaborn.displot to display a distribution of scores for a group of participants. Is it possible to have the y axis show an actual percentage (example

How does one set keyword "block" in plt.show() equal to True by default?

For some reason, I need to set the keyword "block" equal to True explicitly, so that plots are shown when I run a script from the bash shell. (I don't need that

How do I add space between the ticklabels and the axes in matplotlib

I've increased the font of my ticklabels successfully, but now they're too close to the axis. I'd like to add a little breathing room between the ticklabels an

How do I add space between the ticklabels and the axes in matplotlib

I've increased the font of my ticklabels successfully, but now they're too close to the axis. I'd like to add a little breathing room between the ticklabels an

matplotlib: Group boxplots

Is there a way to group boxplots in matplotlib? Assume we have three groups "A", "B", and "C" and for each we want to create a boxplot for both "apples" and "o

matplotlib:plot a line closed

I plot a figure as below: plt.plot(lon,lat,'ro-') plt.show() but the lines aren't closed. How can I make them closed as polygons? thank you