# Matplotlib Questions

Ad

## How can I set the number of ticks in Julia using Pyplot?

I am struggling to 'translate' the instructions i find for python to the use of pyplot in julia. this must be a simple question, but do you know

## How to remove gaps in x axis in matplotlib bar chart?

I have this simple example: from matplotlib import pyplot as plt plt.bar(x=[0,1,2], height=[10,8,6], width=0.5) plt.show()

## PyQt and Netgraph Interactive Graph

I have an application with pyqt and i would like to add the netgraph graphs interactiviness to my application. however, i am not being able

## How to add column labels to graphs

I was wondering, if you can annotate every graph in this example automatically using the column headers as labels.

## Function not showing up in plot

I have function that i wish to show on a plot, but it does not appear. where did i go wrong? (slutt means end in norwegian)

## Group bar charts with completely different groups

I have table looking like this: id year value

## Using Pandas Series of dates(strings) as x ticks on a plot

I have 3 csv's with stock data, all from 2012-01-1 to 2017-01-01. i have used pandas to make dataframes out of them, and am instructed to turn

## Graphing a dictionary with strange formatting in Python

I have a dictionary in python like so: test={'fg':['1','2','3','4','5'],

## Plotting two figures from two xarrays side by side

I'm trying to plot two subplots side by side. each subplot is a variable from xarray, and the plot is a projection. my plotting function

## matplotlib xlabel displayed and set_xticklabels input mismatched

I have two graphs; one on top and one at the bottom. everything but the xaxis label is wrong on the top graph, but everything but the xaxis label

Ad

## matplotlib Bar Chart not Appearing

I am currently trying out matplotlib on python 3 and i am encountering this weird issue with the bar chart bar not showing up. the codes are as

## Trying to save an animation gives error: OSError: Error saving animation to file (cause: [Errno 22] Invalid argument)

I am trying to save an animation, but i get the error: oserror: error saving animation to file (cause: [errno 22] invalid argument)

## Matlab equivalent to Python's figsize

In python's matplotlib.pyplot the figsize command allows you to determine the figure size, eg. from

## Seaborn scatterplot legend showing true values and normalized continuous color

I have a dataframe that i'd like to use to build a scatterplot where different points have different colors: import numpy as np

## How to change yticks in PSD plot?

Download zip with signal.csv i can create a psd plot like

## How to plot a circle at the endpoint of a quiver plot in python?

I have a dataframe consisting of a set of actual positions for x and y and their target positions and i have done the quiver plot for the

## matplotlib contourf with extreme values

I have data i want to plot with extreme edge values, given below is a generic example: import matplotlib.pyplot as plt

## how to change the dimensions of a histogram depicted by plt.hist() as figsize is not an argument

I am trying to plot a histogram with a series using numpy array. n,bins,patch = plt.hist(ser,bins=10, color='green', alpha=0.8,

## Matplotlib barchart legend only shows one item

When creating a legend for a barchart plot, only the first element of the list is added to the legend. i have tried to print the legend by

## how to mark the x axis more than 8 points in pyplot polar

I want to mark my plot as 24 hours and i need to mark every hour. i tried the following code, but the plot only divide into 8 and only mark upto

## Strange edge behaviour of surface plot in matplotlib

I would like to make surface plot of a function which is discontinuous at certain values in parameter space. it is near these discontinuities that

Ad

## matplotlib: add annotation outside of figure

I would like to add an annotation outside of the axes of my figure. it consists of a colored rectangle and a short text. for the rectangle,

## How to make opaque scatter plot in matplotlib

When making a scatter plot in matplotlib, i found that when i change the size of the dots, they become transparent. how can i prevent this from

## How to hide/remove labels with No Data in a multiple labeled horizontal Bar Chart

Following this question: bar chart with multiple labels.

## Plotting bar chart of categorical values for each group

I have a dataframe that i want to group and then to plot (barplot) based on value_counts. import pandas as pd df =

## plot with datetime type in python

I try to plot the distribution of "time" feature . here is my dataframe : date amount 40 2018-12-31 104.588094 184

## plt.savefig stops working when called from another file

I have a code that works well for bulk data analysis and plotting. but now i'm trying to incorporate it into a larger data analysis gui. i find

## Matplotlib Figure to an Axis

I have an api that returns a plt.figure(). i call the api three times to generate three different figures.

## Matplotlib hiding scatters behind voxels

I am trying to visualize a 3d parameter space where i am confident about my parameters with voxels, and where my estimated parameters are with

## Seaborn violin plot - compare all to one

I have a plot like the one below produced by the seaborn docs:

## why scipy.optimize.curce fit function is not fitting the data points correctly and why giving large values of pfit?

In the following code why fitting function is giving large values of pfit and why it is not correctly fitting to the data points. is there

## How do I access certain data from a table?

Just say i have a table of data for people, with the columns being name, age, and height. however i want to show the relationship with only people

Ad

## Matplotlib plot draws straight line, doesn't show correct y-values

I'd like to plot the season on the x-axis and the greens in regulation % on the y-axis. the plot is incorrectly showing up like this:

## How to add matplotlib object to Bokeh layout?

I am working on a tab-based local bokeh application, and i am trying to include a matplotlib object in the first tab of this app. the

## Seaborn is missing a bin of histogram. Is this a bug of seaborn, or my misusing?

This is a piece of code plotting a histogram with matplotlib rng = np.random.randomstate(10) a = rng.normal(size=10000) # set

## PySide2 and Matplotlib: How to make MatPlotLib run in a separate Process? ..as it cannot run in a separate Thread

I am not an experienced programmer and i am trying to create a sort of datalogger program in python using qt for python (pyside2) to build the

## Plotting curves with user defined distance

I am trying to plot a curve with my selection of distance between points in x or y axis. i need to know how can i define the values by myself.

## How to set datetime xlim in seaborn

I have a dataframe: df =

## How can I use matplotlib.pyplot.xticks or similar when using subplots?

I'd like to manipulate the ticks of every plot in my subplots. when plotting a single plot i get the desired result by using:

## Subplot charts plotted within a loop very squashed

I have a dataframe with ~120 features that i would like to examine by year. i am plotting each feature, x = year, y = feature value within a loop.

## set x range in seaborne violinplot by month

I am trying to plot temperature data recorded over the year using a seaborn violinplot. i manage to do the following plot:

## matplotlib crashes in plt.show() on macOS with TkAgg backend

The script runs in a for loop, every iteration calls plt.plot() and after looping calls plt.show() - and crashes (screen

## Python route finder for aviation

I made an app that besides all other things try to find a valid route between 2 airports. i have all the required data in a sqlite3 database witch

Ad

## Python matplot-ting a curve using array append strangely displays lower values at higher positions?

I have a simple file like below with some text and numbers on it: some text pre 69 some text post some text pre 63 some text post

## Consistency with date plotting in pandas dataframe

Pandas sometimes decides to plot dataframes with timeindex in different ways. i am plotting a pandas timeseries dataframe using

## How to plot variance of a changing array using matplotlib?

I am trying to plot the variance of a difference array vs the constant. by equation this is what i am trying to plot diff[n] =

## How do I remove an empty matplotlib AxesGrid cell with an uneven amount of figures?

I am currently trying to create a grid of 7 figures. four of them on the first row and the remaining three on the second row. i have used the

## Polynomial fit using curve_fit()

I've been attempting to get the best polynomial fit possible for my data points using curve_fit() yet my code is giving the following error. could

## Python - Create a single horizontal stacked bar chart from Pandas data?

I'm looking to create a single horizontal stacked bar chart as an alternative to a pie chart to show percentages. i'm pretty sure

## Add pictures to plot using defined anchor points

I'm using python and would like to know what the easiest way, using any library, would be to add images to a plot using defined points on the

## How do I plot a line graph for each row using matplotlib subplots?

I am trying to plot a bond yield curve (line graph) for every row of my data using subplots. how do i go about using loops to create that? is it

## Remove Points / Lines Canvas Python Matplotlib

I use the following code to draw lines in matplotlib with mouse event. every click they save the coordinates and draw lines. from

## Skip first and last point connecting in matplotlib

I am trying to connect points of different colors in graph. but somehow it connect also first and last point i guess (when i am changing

## matplotlib: How to plot an image on a absolute gray scale from 0 to 255

When i try to plot a gray-scale image, sometimes the image is normalized by the min and max pixels in the image. is there anyway to specify an

Ad

## Is there a way to easily (and officialy?) integrate python, and more specifically matplotlib, with flutter?

I'm a scientist with a lot of python background, and i enjoy developping ui for little projects i develop, for fun. i have already built an

## plotly.plot will not plot all the data frames

Im trying to plot four data frames. all the data frames have only one column and datetime as index. im trying to plot all these data frames in one

## Drawing multiple donut charts

I am writing a code to output 3 donut charts. i draw 3 pie charts at first, and then i want to fill each one with a white circle. i am

## Probability of a roll dice

I generated 1,000,000 random number draws using the random module import random liste = [] for i in range(0, 1000000):

## Stacking and counting rectangles in Python

I have over one million overlapping 2d rectangles (not rotated) that i want to stack together and count to form a heatmap/density map/2d histogram

## Stacked barchart in PairGrid python seaborn

I whish to reproduce the pairgrid plot found in

## Animated Scatter Plot

I would like to do an animation in python representing each point, dot by dot. i am doing it as i always have done it, but it does not work. any

## How to set x-ticks to months with `set_major_locator`?

I am trying to use the following code to set the x-ticks to [jan., feb., ...]

## How use custom color mapping and vertically align images in matplotlib?

Image matrix contains only 0,1,2,3 values. can you please suggest how to: convert: [(0, white color),(1, red

## How to draw stacked bar plot from df.groupby('feature')['label'].value_counts()

I get a df.groupby('feature')['label'].value_counts() as follows:

## Forcing labels on histograms in each individual graph in a figure

This is my code thus far: fig =

Ad

## Display image of 2D Sinewaves in 3D

I've generated a 1d sine wave and then repeated it every row to have a 2d sine wave. i can show this in 2d space, but i need to produce a 3d plot

## 2D line not showing clearly along with surface on 3D plot

I am trying to plot a 1d line along with a 2d surface in matplotlib with axes3d: from mpl_toolkits.mplot3d import axes3d import

## split tick labels or wrap tick labels

I have pretty long plot tick labels which unfortunately i cannot shorten. i am thus looking for a code to split the label into multiple lines

## How to fix: "Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created." warning

Anytime i try to plot anything with matplotlib i get this warning. attribute qt::aa_enablehighdpiscaling must be set

## Intersection of a Shapely polygon with a Matplotlib wedge

In this scenario i am plotting

## plt.hist Max bin index is different from the plot

I am trying to get the gray value with maximum pixels count in an image. i am using plt.hist b, bins, patches =

## Matplotlib center/align ticks in imshow plot

I have been trying to center the x and y ticks of my imshow but without success. the desired yticks should be:

## How to show the names of columns of a dataframe in the axes in a Python histogram?

I need to show a histogram of a dataframe variable in python, i need to show a histogram of how many people have a music album. i did this:

## How to generate multiple gaussian plots?

I am trying to plot multiple gaussian plots that'll have same mean and std dev, meaning that when the first plot ends at 20, the second plot must

## How to add annotation arrows to legend

I have a trajectory of some robot, together with some arrows describing parameters of the robot. just like so:

## How to properly remove graph from Tkinter frame

I have several graphs that i want to display on a button press. to do that, i make the plt.figure and figurecanvastkagg

Ad

## Better visualization of matplotlib plot

I want to include a plot in my thesis (document will be standard a4 page pdf) for which i have data of two time series, both a continuous values

## PyCharm import matplotlib.pyplot show error

Import numpy as np import matplotlib.pyplot as plt def main(): x = np.arange(0, 5, 0.1) y = np.sin(x) plt.plot(x, y) if

## How to pass Python doctest with plotting

Is there a way or trick to pass doctest, when output is matplotlib object? doctest framework i also use for examples of code (not only for testing

## Cluster points based on density threshold

Updated my question. see below. i have a scatter plot, with a lot of noise. i only want to plot points above a density

## Why does the color conversion from RGB to HSV produce corrupt images?

Im working on filtering out certain colors of images, but am stuck when it comes to working with the hsv/hsl colorspaces. if i try to convert a

## ConversionError: Failed to convert value(s) to axis units: '2015-01-01'

I am trying to convert values to axis units. i checked codes with similar problems but none addressed this specific challenge. as can be seen in

## matplotlib triplot and tricontourf

I'm attempting to plot a 2d dataset having unstructured coordinates in matplotlib using tricontourf. i'm able to

## How to pick a set of lines instead of just a single line?

I'm plotting multiple lines using matplolib's line2d and want to pick or select all lines at once. the mwe provided plots a triangle

## Limiting latitudinal extend of a cartopy orthographic projection

I am trying to plot a map of a sphere with an orthographic projection of the northern (0-40n) and southern (0-40s) hemispheres, and a mollweide

## Matplotlib simple different colour lines graph

I have a really simple matplot graph and want to change the line colour, when the data is above 50 the line will turn red and below 50 the line

## How to convert DOY (Day of year) to months (as text) in a plot?

I have plots of climate time series for daily mean temperature, precipitation and global radiation. i generated plots like this:

Ad

## How can I plot an ellipse over different centers defined in an array

I am plotting an ellipse and the translating it using the translate function where are define manually dx & dy

## Image standardisation and normalisation using Numpy and OpenCV

I am trying to standardize and then normalise an image using numpy and opencv in the following manner; however, the image that's output from

## At the time of cropping image i face some error like "not enough values to unpack"

I'm trying to crop an image and plot into matplotlib.pyplotusing python but it shows an error import

## How to re-scale the counts in a matplotlib histogram

I have a matplotlib histogram that works fine. hist_bin_width = 4 on_hist = plt.hist(my_data,bins=range(-100,

## How to change number of rows in legend?

I'm trying to create a scatter plot, but the auto-created legend is out from range (0...100).

## Gradient not confined to path in PDF and SVG output

I am filling a path with a gradient based on an example which i have found

## Positive signed tick labels in matplotlib

How is it possible to get a positive +-sign in front of the y tick labels in a matplotlib subplot?

## How to extract coefficients from a line equation in python without using numpy?

I have 2 lists red and blue in the form of (x,y) tuples and a list of line equations in the form of ax+by+c. my requirement is to extract the

## How to show the overlay of an object on an image with only borders in python?

I saw a very nice representation of overlaying results on image in a paper and trying to do a similar approach on my data. here ground truth is

## Plot Y against X as X is a time range for each value of y

I'm trying to plot a simple graph to no avail! instead of this

## Matplotlib animation duration and why it won't stop

Matplotlib animation duration explained that basically

Ad

## Matplotlib Not Plotting negative values: Extremely misleading

Matplotlib is not plotting negative values of my series making its plot extremely misleading. here is the series and plot:

## How to avoid text being upside down after rotation with Matplotlib?

I am trying to place labels on an image with matplotlib. i need to place labels in eight octilinear directions around a node, for which i am

Ad

## Blog Categories

Ad