Category "matplotlib"

Changing the font of ax.text in matplotlib

I am making a python plot using matplotlib. At the start of the code, I use: plt.rcParams['font.family'] = 'serif' plt.rcParams['font.serif'] = ['Times New Ro

How to plot a 2 dimensional density / heatmap in plotnine?

I am trying to recreate the following graph in plotnine. It's asking me for more details but I don't want to distract from the example. I think it's pretty obvi

Plot Cassini ovals in Python using numpy and matplotlib

I am trying to plot Cassini ovals in Python using these parametric equations for x,y. https://mathcurve.com/courbes2d.gb/cassini/cassini.shtml Here is my progra

Add dpi to seaborn or export them with a given dpi

I have a visualization code like: for cluster in ready_couples_2.cluster.unique(): sns.set(rc={'figure.figsize':(11.7,8.27)}) # mask the cluster of int

Sending matplotlib image to pymsteams (cannot create new tag pymsteams)

I am using matplotlib to plot my image. import pandas as pd from matplotlib import pyplot as plt x = ['09:30', '09:33', '09:40', '09:43', '09:50', '09:53', '1

Plot 2d array using matplotlib based on fixed value-based color regions

I'd like to plot a 2d array using matplotlib based on fixed value-based color regions. For example, fixed color regions are 0 < value < 5 = red, 5 < va

How can I find the mode (a number) of a kde histogram in python

I want to determine the X value that has the highest pick in the histogram. The code to print the histogram: fig=sns.displot(data=df, x='degrees', hue="TYPE", k

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 =