Category "matplotlib"

Matplotlib - pyplot is overwriting the backend agg config

I need to change the default matplotlib backend from agg to TkAgg. I have added the line backend: TkAgg to my matplotlibrc file located at ~/.config/matplotlib/

How can I eliminate this disproportionate vertical gap between my x-axis and data in matplotlib? [duplicate]

I have been testing a regression model by graphing its output in matplotlib, but when I do I end up getting a really tall graph with a gap in

Trim data on matplotlib diagonally

Can anyone help me with how to trim plot data on the left side of this straight line besides doing it manually on excel? Thanks enter image description here I'm

Matplotlib quiver: axis lim, legend and color

I'm trying to represent a reference system (triad) or simply three unitary vectors in a matplotib-generated figure in Python. I'm using the following code based

How to plot Dataframe for many rows?

I have a dataset where each row plots an ECG, with 50k rows, 181 columns and has 4 classes, represented in the last column (0, 1, 2, 3). So, I need to "convert"

Matplotlib: connect medians of boxplots with a line [duplicate]

I would like to have a line connecting the medians or means of my boxplots. I use matplotlib. Is there any way to achieve this easily? import

Matplotlib Contour/Contourf in Cartopy singularity at North Pole/ dateline

I am trying to produce heatmaps showing atmospheric attenuation values for a RF link to a satellite above the North Pole, but I have issues with the interpolati

Plotting subplots of dataframe with subplots of piecharts or nested pie chart with Pandas and Matplotlib

Hi my dataframe looks like the followig format and is named immunizations_df: I'm trying to plot a subplot of piecharts, each piechart symbols the number of va

How can I plot a line chart with two different companies monthly sales from 12 months before and 12 months after

The dataframe is a snapshot of what I'm working with. What I want to achieve is a line chart of the monthly sales of the different brands. Months with '-' befor

Multiple Fonts In A Matplotlib Title

I am currently leveraging Matplotlib to generate a variety of graphics and want to use a series of custom fonts. I am specifically using the Milliard font packa

How to I make a image from numpy array in python?

I want to map each numpy array to a color to create an image. For example: if I have the numpy array: [ [0 0 1 3] [0 2 4 5] [1 2 3 6] ] I want to make an ima

How to get colored legend with seaborn barplot

There is a problem with plt.legend in seaborn and matplotlib. What is wrong with it? I can't see the legend color. plt.figure(figsize=(30,10)) plt.xticks(rotati

Annotate bars with values on Pandas bar plots

I was looking for a way to annotate my bars in a Pandas bar plot with the rounded numerical values from my DataFrame. >>> df=pd.DataFrame({'A':np.rand

Remove or change background border line color

I have plotted an image with matplotlib and changed the background facecolor to gray, however there is this white border line around the background. I have trie

Python Grouped bar chart with multiple x-labels

I would like to plot a relatively simpler bar chart but struggling to plot using Matplotlib. Could I get some help please. I would like to prepare a chart as sh

predict function producing too high y values

hi can anyone tell me why my linear regression line is being displayed like https://imgur.com/gallery/u3L2avz. i reverted back to a previous version of my pytho

How to change x-axis labels in Boxplots?

I want to get a picture like this (just focus on the boxplots): As you can see the x-labels of the picture represent the average spacing of the boxplot. I'm tr

How to use dictionary data initialized in a "class" object

I expose the problem quickly: I have to create 3 classes. X Y and Z, inside X y and z are initialized as variables of class x but not as objects Y and Z. What i

python - mpltPath.Path(polygon).contains_points(points)

I have a list of polygon's corners points (polygon) and a list of x,y points (points). when I do mpltPath.Path(polygon).contains_points(points) I get a list of

Why is not the following 3D polar plot of Array Factor being plotted?

import numpy as np import math as mt import matplotlib.pyplot as plt import mpl_toolkits.mplot3d.axes3d as axes3d #############################################