简体   繁体   English

如何在 3D 图上绘制直方图?

[英]How to plot histograms on a 3D plot?

I have collected data on an experiment, where I am looking at property A over time, and then making a histogram of property A at a given condition B. Now the deal is that A is collected over an array of B values.我收集了一个实验的数据,我在一段时间内查看属性 A,然后在给定条件 B 下制作属性 A 的直方图。现在的交易是 A 是在一组 B 值上收集的。 So I have a histogram that corresponds to B=B1, B=B2, ..., B=Bn .所以我有一个对应于B=B1, B=B2, ..., B=Bn的直方图。 What I want to do, is construct a 3D plot, with the z axis being for property B, and the x axis being property A, and y axis being counts.我想要做的是构建一个 3D 图,z 轴是属性 B,x 轴是属性 A,y 轴是计数。

As an example, I want the plot to look like this (B corresponds to Temperature, A corresponds to Rg):例如,我希望绘图看起来像这样(B 对应于温度,A 对应于 Rg):

在此处输入图片说明

How do I pull this off on python?我如何在 python 上解决这个问题?

The python library joypy can plot graphs like this. python 库joypy可以绘制这样的图形。 But I'm not sure if you also want these molecules within your graph.但我不确定您是否也希望在图表中包含这些分子。


Here an example:这里有一个例子:

import joypy

import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import cm
%matplotlib inline


temp = pd.read_csv("data/daily_temp.csv",comment="%")

labels=[y if y%10==0 else None for y in list(temp.Year.unique())]
fig, axes = joypy.joyplot(temp, by="Year", column="Anomaly", labels=labels, range_style='own', 
                          grid="y", linewidth=1, legend=False, figsize=(6,5),
                          title="Global daily temperature 1880-2014 \n(°C above 1950-80 average)",
                          colormap=cm.autumn_r)

Output:输出:

在此处输入图片说明

See this thread as reference.请参阅此线程作为参考。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM