I have a heatmap or a scatterplot of a dataframe. I want to display the 3rd dimension, not only in color, or in a third dimension, but as bars, like a histogram or error bars (maybe?) on the heatmap/scatter plot.
I imagine in a heatmap, I could probably write a code that depending on instensity can input it's value in the nan cells above or below, depending on it's intensity. But I wonder if there is an easier way to do it with a scatter plot.
Scatter plot
var = "pitch(deg)"
fig, ax = plt.subplots(figsize=(8, 8)) ax.scatter(df["x_distance"], df["altitude(m)"], s=10, c=df[var], marker="o", cmap="viridis") plt.show()
Heatmap
var = "pitch(deg)"
heatmap = df[["x_distance","altitude(m)",var]] heatmap_pivot = heatmap.pivot_table( index="x_distance", columns="altitude(m)", values=var) x_flat = heatmap["x_distance"] y_flat = heatmap["altitude(m)"] z_flat = heatmap[var] x_coord = np.linspace(x_flat.iloc[0],x_flat.iloc[-1],len(x_flat)) y_coord = np.linspace(y_flat.iloc[0],y_flat.iloc[-1],len(y_flat)) x_grid,y_grid = np.meshgrid(x_coord,y_coord)
fig, ax = plt.subplots(figsize=(8, 8)) A1 = x_coord A2 = y_coord ax = sns.heatmap(heatmap_pivot, xticklabels=A1, yticklabels=A2) ax.invert_yaxis() ax.invert_xaxis() xlabels = ['{:3.1f}'.format(x) for x in A1] ylabels = ['{:3.1f}'.format(y) for y in A2] ax.set_xticks(ax.get_xticks()[::200]) ax.set_xticklabels(xlabels[::200]) ax.set_yticks(ax.get_yticks()[::200]) ax.set_yticklabels(ylabels[::200])
plt.show()
I would like to plot the color in these plots to be plotted in the vertical direction like an error bar per point. Since there are so many point it would just look like the thickness is increasing and decreasing.
There would also be issue when overlaping with points in the plots that move in vertical directions.
In the heatmap the pixels are so small almost nothing is visible.

