Category "matplotlib"

How to display a text with matplotlib

I would like to do this : I have this python code : import numpy as np import pylab as plt a = np.array([1,2,3,4,5,6,7,8,9,10]) b = np.array([7,8,6,3,2,1,5,8,4

How to scale Seaborn's y-axis with a bar plot

I'm using factorplot(kind="bar"). How do I scale the y-axis, for example with log-scale? I tried tinkering with the plots' axes, but that always messed up the b

align a cartopy 2D map plot with a 1D line plot

I need to align a cartopy 2D map subplot with a 1D line subplot, using the following code: import xarray as xr import cartopy.crs as ccrs import matplotlib.pyp

matplotlib funcanimation update function is called twice for first argument

Going through some tutorials on matplotlib animations and encountered this problem. I am using the matplotlib.animation funcanimation as follows: import matplo

How can I exponentially scale the Y axis with matplotlib

I'm trying to create a matplotlib plot with an exponential(?) Y axis like the fake one I've mocked up below. For my data I want to spread the values out as they

Getting individual colors from a color map in matplotlib

If you have a Colormap cmap, for example: cmap = matplotlib.cm.get_cmap('Spectral') How can you get a particular colour out of it between 0 and 1, where 0 is t

Matplotlib chart does not display in PyCharm

I run the following code in PyCharm 3.4.1, and it highlighted %matplotlib inline showing syntax error, and I delete the first line, and run, I expect it will pr

Keras - Plot training, validation and test set accuracy

I want to plot the output of this simple neural network: model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) history = model.fit

Matplotlib in C++

I would like to use matplotlib to plot an x,y graph. To do this, I downloaded "matplotlibcpp.h" from github : https://github.com/lava/matplotlib-cpp However, in

Connecting means in seaborn box plot

I want to connect box plot means. I can do the basic part but cannot connect box plot means and box plots offset from x axis. similar post but not connecting me

Plot 3D Cube and Draw Line on 3D in Python

I know, for those who know Python well piece of cake a question. I have an excel file and it looks like this: 1 7 5 8 2 4 6 3 1 7 4 6 8

Plot 3D Cube and Draw Line on 3D in Python

I know, for those who know Python well piece of cake a question. I have an excel file and it looks like this: 1 7 5 8 2 4 6 3 1 7 4 6 8

Import "matplotlib" could not be resolved from source Pylance(reportMissingModuleSource)

whenever I try to import matplotlib or matplotlib.pyplot in VS Code I get the error in the title: Import "matplotlib" could not be resolved from source Pylance(

How can I rotate a matplotlib plot through 90 degrees?

I have created a figure in matplotlib which contains three subplots, one in the top left quadrant, one in the top right quadrant, and one in the bottom right qu

Matplotlib - Getting colorbar to line up with colors in plot and to use original values as labels

I have a dataframe with two values x1 and x2, each of these points has a class label. import numpy as np import pandas as pd import matplotlib.pyplot as plt

wireframe not getting displayed for plot_surface

I am trying to draw a 3D plot using matplotlib for my below code, but in the plot wireframe is not displayed over the surface. I thought it might be a problem w

replicating R/ggplot2 colours in python

This link has R code to replicate ggplot's colours: Plotting family of functions with qplot without duplicating data I have had a go at replicating the code in

How to annotate bar chart with values different to those from get_height()

I solved my own question after a long and failed search, so I'm posting the question here and the answer immediately below. The goal: plot percentages but annot

How to rank plot in seaborn boxplot

Take the following seaborn boxplot for example, from https://stanford.edu/~mwaskom/software/seaborn/examples/horizontal_boxplot.html import numpy as np import

Labeling boxplot in seaborn with median value

How can I label each boxplot in a seaborn plot with the median value? E.g. import seaborn as sns sns.set_style("whitegrid") tips = sns.load_dataset("tips") ax