Category "matplotlib"

How to add_subplot figure generated from external function with matplotlib

Currently, I have THREE function to create the graphic, namely get_image_1, get_image_2, and get_image_3 as shown in the function below. def get_image_1():

How to plot zebra style axis in matplotlib

I want plot the axis in a zebra style similar to this: Below is my code: import matplotlib.pyplot as plt import cartopy.io.shapereader as shpreader import c

How to plot zebra style axis in matplotlib

I want plot the axis in a zebra style similar to this: Below is my code: import matplotlib.pyplot as plt import cartopy.io.shapereader as shpreader import c

The sizes of saved vector outputs (PDF, EPS) are too large when using mplcairo as the Matplotlib backend

As the title says, I'm using mplcairo as the Matploblit backend. However, the saved files are too large compared to those using the default Matplotlib backend.

Why is matplotlib .plot(kind='bar') plot so different to .plot()

This may be a very stupid question, but when plotting a Pandas DataFrame using .plot() it is very quick and produces a graph with an appropriate index. As soon

PLS-DA Loading Plot in Python

How can I make a Loading plot with Matplotlib of a PLS-DA plot, like the loading plot like that of PCA? This answer explains how it can be done with PCA: Plot

Update patch edge colours in Geopandas plot

I've plotted a GeoDataFrame as a choropleth using the following code (geopandas 0.2.1, matplotlib 2.0.2, in a Jupyter notebook, using %inline: fig, ax = plt.su

UserWarning: FixedFormatter should only be used together with FixedLocator

I have used for a long time small subroutines to format axes of charts I'm plotting. A couple of examples: def format_y_label_thousands(): # format y-axis tick

Removing "help" tool from Matplotlib toolbar causes: AttributeError: 'NoneType' object has no attribute 'destroy'

In my ubuntu 18.04 VM with Python 3.7.7 and matplotlib 3.3.1 this code works without error: plt.rcParams['toolbar'] = 'toolmanager' fig = plt.figure()

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