Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions examples/gallery/3d_plots/scatter3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,8 @@
zscale=1.5,
)

# Shift plot origin in x direction
fig.shift_origin(xshift="3.1c")
# Add colorbar legend
fig.colorbar()
# Shift the plot origin in x direction temporarily and add the colorbar
with fig.shift_origin(xshift=3.1):
fig.colorbar()

fig.show()
58 changes: 28 additions & 30 deletions examples/gallery/histograms/scatter_and_histograms.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,35 +42,33 @@
# level for all circles to deal with overplotting.
fig.plot(x=x, y=y, style="c0.15c", fill=fill, transparency=50)

# Shift the plot origin and add top margin histogram.
fig.shift_origin(yshift=height + 0.25)
# Shift the plot origin in y direction temporarily and add top margin histogram.
with fig.shift_origin(yshift=height + 0.25):
fig.histogram(
projection=f"X{width}/3",
frame=["Wsrt", "xf", "yaf+lCounts"],
# Give the same value for ymin and ymax to have them calculated automatically.
region=[xmin, xmax, 0, 0],
data=x,
fill=fill,
pen="0.1p,white",
histtype=0,
series=0.2,
)

fig.histogram(
projection=f"X{width}/3",
frame=["Wsrt", "xf", "yaf+lCounts"],
# Give the same value for ymin and ymax to have them calculated automatically.
region=[xmin, xmax, 0, 0],
data=x,
fill=fill,
pen="0.1p,white",
histtype=0,
series=0.2,
)

# Shift the plot origin and add right margin histogram.
fig.shift_origin(yshift=-height - 0.25, xshift=width + 0.25)

# Plot the horizontal histogram.
fig.histogram(
horizontal=True,
projection=f"X3/{height}",
# Note that the x- and y-axis are flipped, with the y-axis plotted horizontally.
frame=["wSrt", "xf", "yaf+lCounts"],
region=[ymin, ymax, 0, 0],
data=y,
fill=fill,
pen="0.1p,white",
histtype=0,
series=0.2,
)
# Shift the plot origin in x direction temporarily and add right margin histogram.
with fig.shift_origin(xshift=width + 0.25):
# Plot the horizontal histogram.
fig.histogram(
horizontal=True,
projection=f"X3/{height}",
# Note that the x- and y-axes are flipped, with the y-axis plotted horizontally.
frame=["wSrt", "xf", "yaf+lCounts"],
region=[ymin, ymax, 0, 0],
data=y,
fill=fill,
pen="0.1p,white",
histtype=0,
series=0.2,
)
fig.show()