Category "matplotlib"

Plot the Decision Boundary of a Neural Network in PyTorch

I've been trying to plot the decision boundary of my neural network which I used for binary classification with the sigmoid function in the output layer but wit

Change the color of inner circle in the polar plot in matplotlib

I am making a polar plot and this is the output of my code Everything is working fine, I just need to know how can I change the edgecolor of the inner-most cir

Why is Shapely plotting two lines when I change a coordinate?

I'm trying to understand how Shapely works. I can draw a simple line with the following code: import matplotlib.pyplot as plt A = Point(0,0) B = Point(1,1)

Python single plot in a for loop without creating a list or array

This may sound like a very naive question. However, to me, it's quite fundamental: Can python plot variables without putting them into arrays or lists? I couldn

sklearn decision tree plot_tree nodes are overlapping

When I plot my sklearn decision tree using sklearn.tree.plot_tree(), the nodes are overlapping on the deeper levels and I cannot read what is in the nodes. It i

Is there a way to customize the feature order in a SHAP beeswarm plot?

I'm wondering if there's a way to change the order the features in a SHAP beeswarm plot are displayed in. The docs describe "transforms" like using shap_values.

Relimit pyplot.psd y-axis plot based on frequency range

So I'm trying to find the psd of various signals sampled at different frequencies and compare them in the 0-50Hz range I have this code: for i, th in enumerat

CNN accuracy plotting

I used a convolutional neural network (CNN) for training a dataset and I want to plotting accuracy for this. Before, I tried to use matplotlib but I couldn't su

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