# Makie.jl figure with broken axis

**URL:** <https://discourse.julialang.org/t/makie-jl-figure-with-broken-axis/85062>\
**Category:** Visualization\
**Tags:** plotting, makie\
**Created:** [July 31, 2022, 1:57pm UTC](https://discourse.julialang.org/t/makie-jl-figure-with-broken-axis/85062 "2022-07-31T13:57:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin\_Kleinbeck](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevin_kleinbeck/32/21278_2.png) [@Kevin\_Kleinbeck](https://discourse.julialang.org/u/Kevin_Kleinbeck)\
**Post date:** [July 31, 2022, 1:57pm UTC](https://discourse.julialang.org/t/makie-jl-figure-with-broken-axis/85062/1 "2022-07-31T13:57:32Z")

</div>

I intend to create a figure with a broken Axis, which can be useful when the data range is relatively large but relevant details occur only close to the maximal / minimal values.

For example, let’s say we want to create a figure like this one  
 ![Test](https://global.discourse-cdn.com/julialang/original/3X/a/4/a4d5f2fddae5f305eb0664d2fe8ab16f37719ace.png)  
We can create the entire figure by drawing the top and bottom half separately, however I cannot figure out how to get the red diagonal lines, which are commonly used to indicate broken axes (in black of course, I used red here for emphasis).

I tried a manual approach using `poly!(...)`, but this fails, as poly cannot draw outside of the axis. On the other hand a solution could be to specify the end markers for the spines, for example like many textbook figures have arrow heads. But, afaik, Makie cannot do that?!?

I used the following code to create the above figure, minus the red, diagonal indicator lines:

```julia
function makeTestFigure()
	fig = Figure(resolution = (150, 150), fontsize = 10)

	axisMain = Axis(fig[1, 1],
		xlabel = "x Label", ylabel = "y Label",
		ytickcolor = :white, yticklabelcolor = :white, ygridvisible = false,
		leftspinecolor = :white, rightspinecolor = :white,
		bottomspinecolor = :white, topspinecolor = :white
	)
	xlims!(axisMain, (-1, 6.))

	axisLow = Axis(fig[1, 1],
		ylabel = "Lorem Ipsum", ylabelcolor = RGBA(1.0, 1.0, 1.0, 1.0),
    ylabelpadding = 2.0, yticklabelsize = 8, height = Relative(0.33), valign = 0.0,
		topspinecolor = :white, yticks = [0, 1]
	)
	hidexdecorations!(axisLow)
	xlims!(axisLow, (-1., 6.))
	ylims!(axisLow, (-0.2,-0.2+1.5))

	axisHigh = Axis(fig[1, 1],
		ylabel = "Lorem Ipsum", ylabelcolor = RGBA(1.0, 1.0, 1.0, 1.0),
    ylabelpadding = 2.0, yticklabelsize = 8, height = Relative(0.55), valign = 1.0,
		bottomspinecolor = :white, yticks = [9, 10, 11]
	)
	hidexdecorations!(axisHigh)
	xlims!(axisHigh, (-1, 6.))
	ylims!(axisHigh, (8.5, 11.))

	boxcar(t) = t > 0. && t < 5. ? 10. : 0.
	ts = range(-1.0, 6., length = 101)
	for axis ∈ [axisLow, axisHigh]
		lines!(axis, ts, boxcar.(ts))
	end

	fig
end

```

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [July 31, 2022, 5:15pm UTC](https://discourse.julialang.org/t/makie-jl-figure-with-broken-axis/85062/2 "2022-07-31T17:15:49Z")

</div>

This could still kind of work [Break axis in Makie - #10 by jules](https://discourse.julialang.org/t/break-axis-in-makie/62729/10)

Just that now I would plot such things into ax.blockscene

---

<div class="post-metadata">

**Author:** ![Kevin\_Kleinbeck](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevin_kleinbeck/32/21278_2.png) [@Kevin\_Kleinbeck](https://discourse.julialang.org/u/Kevin_Kleinbeck)\
**Post date:** [August 1, 2022, 7:02am UTC](https://discourse.julialang.org/t/makie-jl-figure-with-broken-axis/85062/3 "2022-08-01T07:02:39Z")

</div>

Any way to read into the internal stuff? The documentation, for example, doesn’t even know about `ax.blockscene`

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [August 1, 2022, 7:09am UTC](https://discourse.julialang.org/t/makie-jl-figure-with-broken-axis/85062/4 "2022-08-01T07:09:05Z")

</div>

It’s still internal so there won’t be documentation on that soon I think. It just backs us into a corner if we make too many implementation details public API. But because the mechanisms behind it rarely change you can usually hack on the elements in similar ways. For example plotting in different scenes within a Figure etc.
