Category "matplotlib"

Cartopy: coastlines not lining up with imshow projection

I'm trying to produce a figure in Python that will line up the map coastlines from Cartopy with a RGB projection using satellite data (POLDER) that is fixed to

Adding a black edgecolor around to legend entries in matplotlib

I've made this pie chart in python and I would like to know how to add a black frame around each boxcolor in the legend. I mean around of each color square like

How to improve the given line of code while filtering pandas dataframe?

The below line of code was to filter a dataframe. I would like to know how to improve this line of code T1_df = df2[((df2['Azimuth'] > (df2['Sim_Az'] - 1

Seaborn not plotting head but instead plots whole dataframe

I have a dataframe that I groupby() count and then sort_values() by count. I then take the head() and tail() of this dataframe to plot on a seaborn barplot(). H

Displaying a stacked bar graph with nested lists

I am trying to display a stacked bar graph.I have 3 lists as shown below- totalpointperxaxis [6, 9, 13, 5, 14, 382, 26, 2, 45, 2] clusternamesList [['Cluster1'

How to do the visualization of Optimal Classification Trees in python

I used the code in github:https://github.com/pan5431333/pyoptree. I read the raw code and did not find how to draw the tree, please give me some useful guide to

Nested bar plots with three y axis using seaborn package

Using the python seaborn package I was trying to plot the nested bar graphs with three different y-axes as shown in the below figure: And the code that I have

I want to animate the solar system with python matplotlib

So basically I have this project at school where we decide something we want to plot. I decided to plot the solar system animated to find out when is the next t

How can I plot Gaussian pseudo-random noise for N = 2?

How would one plot the Gaussian pseudo-random noise when N = 2 from the given code below? I don't know how to incorporate N into the formula in the code. I need

How to control the color of a specific column in a bar plot depending on it's xtick label?

I have a number of plots that show transcribed text from a speech to text engine in which I want to show the bars where the S2T engine transcribed correctly. I

Highlighting specific data points for parallel coordinates plot

I'm looking for help to highlight/color particular data points on the parallel coordinates plot. I can't seem to find a way that work. Essentially, I want to pl

Matplotlib plots in the wrong data format eventhough it is a datetime object [duplicate]

I have a problem when trying to plot a timeseries with matplotlib: df = pd.read_csv('myfile.dat', skiprows=1) #Change data type to datetime d

How to shared color palette between multiple subplots?

I have the following figure: The figure is composed by the following code snippet: fig = plt.figure(constrained_layout=True) grid = fig.add_gridspec(2, 2) ax_

How to draw a vertical line with double left click while using blitting in matplotlib?

I'm trying to write a program which would let user to create vertical line on the chart in the place of double left click. Actually I already can write this kin

How to map 5 numbers to 5 different colors

I have a problem concerning the management of a colormap. In the figure below, each point displayed is associated with a value : 2, 3, 4, 5 or 13. So, to know t

How can I plot a pandas dataframe where x = month and y = frequency of text?

I have the following dataset: Date ID Fruit 2021-2-2 1 Apple 2021-2-2 1 Pear 2021-2-2 1 Apple 2021-2-2 2 Pear 2021-2-2 2 Pear 2021-2-2 2 Apple 2021-3-2 3 Apple

Matplotlib: Where is the first axes object located?

Usually when I make a single plot, I just call fig,ax = plt.subplots() without specification as to where to place the axes object in the figure. But when I want

Display text on point cloud vertex in pyrender/open3d

I am using SMPL demo code to display the SMPL-X mesh of a person. Instead of taking the default body joints, I need to select vertices corresponding to some oth

Proper automatic logarithmic axes when plot range less than a factor 10 (Matplotlib)

When the data range of logarithmic plots does not include a full factor of 10, the current (v3.5) Matplotlib code does not automatically produce publication-qua

Generate Network Graph in Python from nested dictionary

I have an input dictionary like: d={'node1':{'node1_1':1.2,'node1_2':1.3,'node1_3':1.2},'node2': {'node2_1':1.3,'node2_2':1.3,'node2_3':1.4}} In th