matplotlib

Matplotlib in py2exe — ImportError: cannot import name dist (File “distutils\__init__.pyc”)

微笑、不失礼 提交于 2021-02-18 12:09:43
问题 Matplotlib working in this app perfectly.. but not working in build for some reason. Why? I'll gladly take any advice that can help me. .exe.log : Traceback (most recent call last): File "main.py", line 3, in <module> File "zipextimporter.pyc", line 82, in load_module File "matplotlib\__init__.pyc", line 103, in <module> File "zipextimporter.pyc", line 82, in load_module File "distutils\__init__.pyc", line 25, in <module> ImportError: cannot import name dist main.py is a script that I'm

超强大!Python 可视化这款大屏就够了!

杀马特。学长 韩版系。学妹 提交于 2021-02-18 11:41:55
对于从事数据领域的小伙伴来说,当需要阐述自己观点、展示项目成果时,我们需要在最短时间内让别人知道你的想法。我相信单调乏味的语言很难让别人快速理解。最直接有效的方式就是将数据进行可视化展现。 提到数据可视化,我们会想到 Plotly、Matplotlib、Pyecharts等可视化库,或者一些商用软件Tableau、FineBI等等。如果你希望操作更简单、展现效果更强大,那么这款工具 big_screen 更适合你了,本文介绍具体如下: • big_screen 特点 • 安装环境 • 输入数据 • 结果展示 • 在线部署 • 代码领取 big_screen 特点 便利性工具, 结构简单, 你只需传数据就可以实现数据大屏展示。 安装环境 pip install - i https : //pypi.tuna.tsinghua.edu.cn/simple flask 输入数据 在文件夹 data.py 中更新你需要展示的数据即可,如下为部分数据展示: self . echart1_data = { 'title' : '行业分布' , 'data' : [ { "name" : "商超门店" , "value" : 47 }, { "name" : "教育培训" , "value" : 52 }, { "name" : "房地产" , "value" : 90 }, { "name"

How can I generate and display a grid of images in PyTorch with plt.imshow and torchvision.utils.make_grid?

一曲冷凌霜 提交于 2021-02-18 10:49:52
问题 I am trying to understand how torchvision interacts with mathplotlib to produce a grid of images. It's easy to generate images and display them iteratively: import torch import torchvision import matplotlib.pyplot as plt w = torch.randn(10,3,640,640) for i in range (0,10): z = w[i] plt.imshow(z.permute(1,2,0)) plt.show() However, displaying these images in a grid does not seem to be as straightforward. w = torch.randn(10,3,640,640) grid = torchvision.utils.make_grid(w, nrow=5) plt.imshow(grid

matplotlib Slow 3D scatter rotation

混江龙づ霸主 提交于 2021-02-18 10:47:06
问题 I am using matplotlib to scatter plot a 3D matrix of points. I am using the following code: import pylab as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np my_data = np.random.rand(6500,3) # toy 3D points fig = plt.figure() ax = Axes3D(plt.gcf()) ax.scatter(my_data[:,0],my_data[:,1],my_data[:,2]) plt.show() It works, so it opens a window where I can see my points. However if I try to rotate the plot with the mouse (clicking and dragging it) it rotates REALLY slow. I think 6500

matplotlib plot csv file of all columns

你离开我真会死。 提交于 2021-02-18 08:45:40
问题 I have a csv file which contains 20 columns. Right now I can plot using this code taking first column as x axis and rest of them as y axis. import numpy as np import matplotlib.pyplot as plt data = np.genfromtxt('cs.csv',delimiter=',', dtype = float) a = [row[0] for row in data] b = [row[1] for row in data] c = [row[2] for row in data] fig = plt.figure() ax = fig.add_subplot(111, axisbg = 'w') ax.plot(a,b,'g',lw=1.3) ax.plot(a,c,'r',lw=1.3) plt.show() The problem is here I have to define all

matplotlib plot csv file of all columns

耗尽温柔 提交于 2021-02-18 08:45:28
问题 I have a csv file which contains 20 columns. Right now I can plot using this code taking first column as x axis and rest of them as y axis. import numpy as np import matplotlib.pyplot as plt data = np.genfromtxt('cs.csv',delimiter=',', dtype = float) a = [row[0] for row in data] b = [row[1] for row in data] c = [row[2] for row in data] fig = plt.figure() ax = fig.add_subplot(111, axisbg = 'w') ax.plot(a,b,'g',lw=1.3) ax.plot(a,c,'r',lw=1.3) plt.show() The problem is here I have to define all

matplotlib plot csv file of all columns

本秂侑毒 提交于 2021-02-18 08:45:21
问题 I have a csv file which contains 20 columns. Right now I can plot using this code taking first column as x axis and rest of them as y axis. import numpy as np import matplotlib.pyplot as plt data = np.genfromtxt('cs.csv',delimiter=',', dtype = float) a = [row[0] for row in data] b = [row[1] for row in data] c = [row[2] for row in data] fig = plt.figure() ax = fig.add_subplot(111, axisbg = 'w') ax.plot(a,b,'g',lw=1.3) ax.plot(a,c,'r',lw=1.3) plt.show() The problem is here I have to define all

Python Histogram ValueError: range parameter must be finite

扶醉桌前 提交于 2021-02-18 08:05:16
问题 when plotting Pandas dataframe using a histogram, sample dataframe data distance 0 5.680195 2 0.000000 3 7.974658 4 2.461387 5 9.703089 code I use to plot import matplotlib.pyplot as plt plt.hist(df['distance'].values) plt.show() I have this error "ValueError: range parameter must be finite." my attempt df['Round_Distance'] = df['distance'].round(1) 0 5.7 2 0.0 3 8.0 4 2.5 5 9.7 plot again, new error plt.hist(df['Round_Distance'].values) plt.show() ValueError: max must be larger than min in

Python Histogram ValueError: range parameter must be finite

[亡魂溺海] 提交于 2021-02-18 08:04:32
问题 when plotting Pandas dataframe using a histogram, sample dataframe data distance 0 5.680195 2 0.000000 3 7.974658 4 2.461387 5 9.703089 code I use to plot import matplotlib.pyplot as plt plt.hist(df['distance'].values) plt.show() I have this error "ValueError: range parameter must be finite." my attempt df['Round_Distance'] = df['distance'].round(1) 0 5.7 2 0.0 3 8.0 4 2.5 5 9.7 plot again, new error plt.hist(df['Round_Distance'].values) plt.show() ValueError: max must be larger than min in

Matplotlib: 3 plots plotted in 2 rows with single image centered

假装没事ソ 提交于 2021-02-18 07:10:56
问题 I have a 3 figure plot. I would like to have two rows of images with 2 plots on the top row, and 1 on the bottom. I need to center align the single plot on the second row. fig, ax = plt.subplots(nrows=2, ncols=2) x = np.arange(0.01,1.01,0.01) y = np.arange(0.01,1.01,0.01) X,Y = np.meshgrid(x, y) # grid of point Z = 1/((1/X)+(1/Y)-1) F = Y / X values = [0.3, 0.5, 0.8, 1.0, 1.3, 1.5, 2.0, 3.0, 5.0, 10.0] #Plot 0 ax[0,0].set_aspect('equal') CS = ax[0,0].contour(X,Y,Z,np.arange(0.1,1.0,0.1)