matplotlib

AttributeError: tkagg has no attribute cursord

亡梦爱人 提交于 2021-02-10 20:38:20
问题 I recently reinstalled anaconda to shift the directory over from an admin account to my personal account. Previously, I had no issue with the code below import matplotlib.backends.backend_tkagg as tkagg defaultcursor = tkagg.cursord[1] Now, it gives the following error: AttributeError: module 'matplotlib.backends.backend_tkagg' has no attribute 'cursord' any idea why this is happening? 来源: https://stackoverflow.com/questions/54002098/attributeerror-tkagg-has-no-attribute-cursord

matplotlib: autoalign labels of yaxis in subplots using a transform

别等时光非礼了梦想. 提交于 2021-02-10 20:27:26
问题 I want to align my y-axis labels like in this example. However, I don't want to use a fixed value like ax4.yaxis.set_label_coords(labelx, 0.5) , but rather something like this: x = np.linspace(-np.pi, np.pi, 100) y1 = np.sin(x)**2 y2 = np.sin(x) fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True) ax1.plot(x, y1) ax2.plot(x, y2) ax1.set_ylabel('y1') ax2.set_ylabel('y2') The position of the lower label is "correct". I want to determine its x-coordinate and apply it to the upper label. How do I do

matplotlib: autoalign labels of yaxis in subplots using a transform

↘锁芯ラ 提交于 2021-02-10 20:21:42
问题 I want to align my y-axis labels like in this example. However, I don't want to use a fixed value like ax4.yaxis.set_label_coords(labelx, 0.5) , but rather something like this: x = np.linspace(-np.pi, np.pi, 100) y1 = np.sin(x)**2 y2 = np.sin(x) fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True) ax1.plot(x, y1) ax2.plot(x, y2) ax1.set_ylabel('y1') ax2.set_ylabel('y2') The position of the lower label is "correct". I want to determine its x-coordinate and apply it to the upper label. How do I do

import matplotlib failed in Anaconda python3.6

时光总嘲笑我的痴心妄想 提交于 2021-02-10 20:14:10
问题 I installed Anaconda to simplify the management of many python modules. After that i tried to "import subprocess": >>> import subprocess Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/sej/.config/anaconda3/lib/python3.6/subprocess.py", line 155, in <module> _PopenSelector = selectors.SelectSelector AttributeError: module 'selectors' has no attribute 'SelectSelector' How to fix this? I came accross this problem by trying to use matplotlib. When trying to

Regression line using Relplot in seaborn

老子叫甜甜 提交于 2021-02-10 20:00:35
问题 Below is a working example where I need to draw regression line. I have searched online but I see another function like regplot, implot to draw regression lines but here I am using replot. How I can draw regression line using relplot? from matplotlib import pyplot as plt import pandas as pd import seaborn as sns d = {'x-axis':[100,915,298,299], 'y-axis': [1515,1450,1313,1315], 'text':['point1','point2','point3','point4']} df = pd.DataFrame(d) p1 = sns.relplot(x='x-axis', y='y-axis',data=df )

Quickly Plotting Polar Radar Data using Python?

倖福魔咒の 提交于 2021-02-10 19:57:28
问题 I've got an interesting application that requires transforming 3D polar data (angle, distance, and value at that point) into images representing the data. It's NOAA NEXRAD radar data that I'm using in a custom application. The data is stored in 3 arrays, range_data (the distance from the radar in meters, 1800 points), azimuth_data (the angle in 0.5 degree steps, 720 points), and radar_data (a 720x1800 array containing a data value for each combination of range and azimuth). This is the format

Quickly Plotting Polar Radar Data using Python?

一世执手 提交于 2021-02-10 19:57:28
问题 I've got an interesting application that requires transforming 3D polar data (angle, distance, and value at that point) into images representing the data. It's NOAA NEXRAD radar data that I'm using in a custom application. The data is stored in 3 arrays, range_data (the distance from the radar in meters, 1800 points), azimuth_data (the angle in 0.5 degree steps, 720 points), and radar_data (a 720x1800 array containing a data value for each combination of range and azimuth). This is the format

Memory increases with matplotlib and tkinter

别来无恙 提交于 2021-02-10 18:49:09
问题 Problem: I have a tkinter window with a matplotlib graph showing some lines (part of a much larger program). Periodically I add a new line, deleting an oldest one to limit the number of lines shown. Unfortunately the program grows in size continuously. I've seen this on both Windows and Linux. Question: How should I write a long-running graph frame to show the last n lines which doesn't use up all my memory? Preferably by tweaking the code below, but I'm prepared for a complete re-write if

Memory increases with matplotlib and tkinter

旧时模样 提交于 2021-02-10 18:46:31
问题 Problem: I have a tkinter window with a matplotlib graph showing some lines (part of a much larger program). Periodically I add a new line, deleting an oldest one to limit the number of lines shown. Unfortunately the program grows in size continuously. I've seen this on both Windows and Linux. Question: How should I write a long-running graph frame to show the last n lines which doesn't use up all my memory? Preferably by tweaking the code below, but I'm prepared for a complete re-write if

Seaborn correlation heatmap with equal cell size

夙愿已清 提交于 2021-02-10 16:18:08
问题 I am plotting various correlation matrices with a different number of columns using seaborn. For the sake of eye-candy, I'd like to have all correlation matrices to have the same cell size. Unfortunately, I am not able to parameterize seaborn to do so. Here is a minimal example: from string import ascii_letters import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt # Generate two random dataset rs = np.random.RandomState(42) d1 = pd.DataFrame(data=rs