matplotlib

Matplotlib dates YearLocator with odd intervals

别说谁变了你拦得住时间么 提交于 2021-02-05 05:59:32
问题 Right now I have a working bit of code that formats to my specification when my time series begin at the start of a decade (i.e. 1990, 2000, 2010,etc.), but I don't know how to adapt my code to have the correct formatting when my time series begins at a year that isn't even (i.e. 1993). import pandas as pd import matplotlib.pyplot as plt from matplotlib import dates def format_xaxis(fig): years = dates.YearLocator(10,month=1,day=1) years1=dates.YearLocator(2,month=1,day=1) dfmt = dates

get Coordinates of matplotlib plot figure python with mouse click

£可爱£侵袭症+ 提交于 2021-02-05 05:49:26
问题 I have been trying to get the mouse x,y coordinates to variables according to matplotlib plot scale not pixels but it only returns me the integer components like 0.0 or 1.0 I want to return the accurate number like 0.1245 here is my code import matplotlib import Tkinter as tk from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg from matplotlib.figure import Figure import numpy as np import matplotlib.pyplot as plt def onclick(self,event): ix, iy = float

Trouble with “ cv2.imshow ()” function

别等时光非礼了梦想. 提交于 2021-02-05 05:45:09
问题 I installed openCV and numpy libraries in python 2.7. I've tested them using commands import cv2 and import numpy and it compiled. But when I use the cv2.imshow('frame', ----) function it displays a window but not displaying the image. And it's showing " frame is Not Responding". So, I tried with matplotlib functions for displaying image and it worked. I inserted cv2.imshow function in the 2nd case and it worked. Versions [Python-2.7.10, OpenCV-2.4.11] Below is the code, Case 1: Not Working

How to show only the outline of a bar plot matplotlib

我们两清 提交于 2021-02-05 05:43:12
问题 I'm plotting data as a bar plot in matplotlib and am trying to only show the outline of the bars, so that it appears as a 'stepped graph' of the data. I've added my code below along with an image of the desired output. plt.bar(x, y, align='center', width=0.1, edgecolor='black', color='none') The plot I have: The plot I would like: Are there any other libraries that may be able to produce this? The bar keyword arguments don't seem to have anything that can. 回答1: Your image looks like a

How to show only the outline of a bar plot matplotlib

元气小坏坏 提交于 2021-02-05 05:42:22
问题 I'm plotting data as a bar plot in matplotlib and am trying to only show the outline of the bars, so that it appears as a 'stepped graph' of the data. I've added my code below along with an image of the desired output. plt.bar(x, y, align='center', width=0.1, edgecolor='black', color='none') The plot I have: The plot I would like: Are there any other libraries that may be able to produce this? The bar keyword arguments don't seem to have anything that can. 回答1: Your image looks like a

How to show only the outline of a bar plot matplotlib

好久不见. 提交于 2021-02-05 05:42:17
问题 I'm plotting data as a bar plot in matplotlib and am trying to only show the outline of the bars, so that it appears as a 'stepped graph' of the data. I've added my code below along with an image of the desired output. plt.bar(x, y, align='center', width=0.1, edgecolor='black', color='none') The plot I have: The plot I would like: Are there any other libraries that may be able to produce this? The bar keyword arguments don't seem to have anything that can. 回答1: Your image looks like a

Display SVG file in Python

吃可爱长大的小学妹 提交于 2021-02-04 21:01:31
问题 I'm creating a Python3 program that generates SVG images with random circles that I need for a personal project. Right now the program works perfectly, but I'd like to fine-tune some parameters to produce the best results possible. My idea is to have a display window that shows the intermediate result and an interactive shell to change some of the values that generate the position of the circles, without having to create thousands of different images and compare them. When I finish I can

error bars at the limits in matplotlib barchart

大城市里の小女人 提交于 2021-02-04 20:58:18
问题 I'm trying to get the errorbars to show at the confidence interval's limits, and not in the center. What I want is this: but what I'm getting is this: To plot the bar chart I used this: import pandas as pd import numpy as np import matplotlib.pyplot as plt np.random.seed(12345) df = pd.DataFrame([np.random.normal(32000,200000,3650), np.random.normal(43000,100000,3650), np.random.normal(43500,140000,3650), np.random.normal(48000,70000,3650)], index=[1992,1993,1994,1995]) df1 = df.T df1.columns

error bars at the limits in matplotlib barchart

那年仲夏 提交于 2021-02-04 20:58:10
问题 I'm trying to get the errorbars to show at the confidence interval's limits, and not in the center. What I want is this: but what I'm getting is this: To plot the bar chart I used this: import pandas as pd import numpy as np import matplotlib.pyplot as plt np.random.seed(12345) df = pd.DataFrame([np.random.normal(32000,200000,3650), np.random.normal(43000,100000,3650), np.random.normal(43500,140000,3650), np.random.normal(48000,70000,3650)], index=[1992,1993,1994,1995]) df1 = df.T df1.columns

Problems With Contours Using Python's matplotlib 3D API

て烟熏妆下的殇ゞ 提交于 2021-02-04 20:52:46
问题 I'm trying to do something similar to this 3D example from the docs, but with a point cloud instead of a smooth surface. The example projects 2D contours onto each of the three coordinate planes. This shows that I'm able to do that onto the xy-plane. When I try doing the same onto the other two planes, I get either a weird contour collapsed down to a thin strip, or an exception way beyond my reach in the bowels of matplotlib . Traceback (most recent call last): File ".../matplotlib/backends