Category "matplotlib"

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

How to set a different axes system on a matplotlib plot?

I have a matplotlib plot on which I found the coordinates of given points like this: I am trying to find a way to add different axes on the same plot, and get

Having an issue plotting: Columns must be same length as key

I'm new to Python and I'm trying to adjust this code to my data: import random import pandas as pd import numpy as np import matplotlib.pyplot as plt import mat

How to solve error with limits in boxplot (seaborn)?

The code used to plot the box plot: import seaborn as sns ax= sns.boxplot(x = "Current_Sim_Az_obj1",y= "RUT_Distance",data = df2,whis = (0,100),meanline= True,s

why plotting a (112,112,2) in matplotlib using imshow() is not possible?

why is it that we can not plot a matrix that has the shape (112,112,2) but doing it for shapes such as (112,112,3)is ok ? TypeError: Invalid shape (112, 112, 2)

plotting white stuff over a plot in python

I've got some trouble with plotting white spans over a plot. I've created and plotted a given function y(x) and defined some "forbidden" regions, corresponding

Formating a frequency dataframe to a table and a histogram

If I have a frequency table like below: ret < -1(%) -1 < ret < -0.5(%) -0.5 < ret < 0(%) 0 < ret < 0.5(%) 0.5 < ret <

How to remove gaps between adjacent matplotlib patches

I am trying to plot a collection of finite element data with colored patches used to represent the value in each element. Unfortunately, when I plot the patches

Place ipywidget Dropdown on screen in matplotlib.pyplot axes ax1

When I run this code, the Dropdown is nowhere to be found. How do I make it appear in ax1? (I think I would like to avoid Tkinter.) #!/usr/bin/env python3 #Pla

How to draw a continuous contour plot with discrete coordinate data (DataFrame form)?

The row data has 3 columns and cannot shape a uniform grid based on 'x'&'z', so I am not able to plot the contour as the existed question: Create Contour Pl

plotting error bar on x-axis on a timeseries python

I have data representing mean concentrations over 5 months, some means are over a 24 h period and some are weekly means. I want to plot everything as a scatterp

Datetime Objects on X-axis with matplotlib

I'm plotting some data using matplotlib with DateTime objects on the x-axis, but can't seem to figure out why my DateTime values aren't spaced out on the x-axis