Category "matplotlib"

Real time plotting of serial data with python and tkinter

I have been working for some time to find a way to graph incoming data from an arduino with a Python GUI. I was able to accomplish this using the Matplotlib ani

How to deal with NaN value when plot boxplot using python

I am using matplotlib to plot a box figure but there are some missing values (NaN). Then I found it doesn't display the box figure within the columns having NaN

ImportError: cannot import name '_png' from 'matplotlib'

I'm currently working with Python 3.7 on Pycharm and trying to get a better understanding of kivy. I found a script that I'm trying to run but I'm encountering

matplotlib Axes.plot() vs pyplot.plot()

What is the difference between the Axes.plot() and pyplot.plot() methods? Does one use another as a subroutine? It seems that my options for plotting are line =

How to fix this legend to place the label beside the markers

How would I fix this legend such that the labels (numeric values ) are placed beside the legend entry/marker import pandas as pd from matplotlib import pyplot a

How to plot the cluster's centroids using seaborn

Basically, I want to plot like this: I already managed to plot the clusters using sns.scatterplot(X[:,0], X[:,1], hue=y, palette=['red', 'blue', 'purple', 'gre

Matplotlib: display element indices in imshow

From this answer I know how to plot an image showing the array values. But how to show the i,j indices of each element of the array, instead of the values thems

Off-center X-Axis in Seaborn

I'm having an issue getting my boxplot to align with my x axis labels. I've tried adjusting the size of the chart, but the data points still look a little off.

Remove one out of two legends from Seaborn Scatterplot

Using the 'tips' dataset as a toy model, I generate the following plot: import seaborn as sns import matplotlib.pyplot as plt tips = sns.load_dataset("tips")

Plot elapsed time on x axis using date indexed time-series data

In my pandas dataframe, my time series data is indexed by absolute time (a date of format YYYY-MM-DD HH24:MI:SS.nnnnn): 2017-01-04 16:25:25.143493 58 2017-0

KeyError: 'scale' for import matplotlib.pyplot as plt

I'm getting KeyError: 'scale' when I'm trying to run import matplotlib.pyplot I redownloaded the matplotlib then ran the code but still getting the same error

Multiple color fills in matplotlib markers

I want to use multiple colors in a marker made with matplotlib. Doing two colors was not that difficult, following this example, and with some additional info f

How to create and annotate a stacked proportional bar chart

I'm struggling to create a stacked bar chart derived from value_counts() of a columns from a dataframe. Assume a dataframe like the following, where responder i

Using matplotlib to create a spectrogram of a wavfile

import scipy.io.wavfile as wav import matplotlib.pyplot as plt import scipy sample_rate, X = wav.read("/Users/sinaastani/Downloads/partynextdoor.wav") X = scipy

conda install matplotlib results in huge list on incompatibilities

I have a conda env that I build from a requirements.yml file that I obtained from a classmate so we could work on a project together. I tried installing matplot

Plotting all of a trigonometric function (x^2 + y^2 == 1) with matplotlib and python

As an exercise in learning Matplotlib and improving my math/coding I decided to try and plot a trigonometric function (x squared plus y squared equals one). Tr

How to plot a figure with Chinese Characters in label

When I draw a figure with Chinese Character label in Python 3, it doesn't work correctly: ] My code: fig = pd.DataFrame({ '债券收௡

Change the facecolor of boxplot in pandas

I need to change the colors of the boxplot drawn using pandas utility function. I can change most properties using the color argument but can't figure out how t

'Cursors' object has no attribute 'RESIZE_HORIZONTAL' in qt bindings with %matplotlib qt

That is what appears when I run %matplotlib qt. Along with this error message, I tried widget which gave me the same answer (+ try to use qt). PyQt5 is imported

Python: How to plot heat map of 2D matrix by ignoring zeros?

I have a matrix of size 500 X 28000, which contains a lot of zeros in between. But let us consider a working example with the matrix A: A = [[0, 0, 0, 1, 0],