# Plotlyjs and composite figures

**URL:** https://discourse.julialang.org/t/plotlyjs-and-composite-figures/97320
**Category:** General Usage
**Tags:** plots, plotlyjs
**Created:** [April 10, 2023, 9:35pm UTC](https://discourse.julialang.org/t/plotlyjs-and-composite-figures/97320 "2023-04-10T21:35:50Z")
**Posts on this page:** 1
**Showing post:** 8

<div class="post-metadata">

### Author: ![disberd](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@disberd](https://discourse.julialang.org/u/disberd)
#### Post date: [April 13, 2023, 9:11am UTC](https://discourse.julialang.org/t/plotlyjs-and-composite-figures/97320/8 "2023-04-13T09:11:27Z")

</div>

I can’t reproduce your exact code as `Lx` and `Ly` are not defined in the pasted code you gave so an error is thrown.  
You should be able to to remove the fill of the contour zones and have just the coloring of the contour lines controlled by the `line_color` attribute by adding to your countour call the following kwarg: `contours_coloring="none"`.  
So your contour call above would be:

```julia
contour(x=x, y=y, z=g', mode="lines", line_width=2, contours_coloring="none")

```

Note: I removed the colorscale to contour as if you set `contours_coloring` to `"none"` no colorbar is generated and the color of the line of the contour is not controlled by the colorscale but by `line_color`.

Edit: I just noted you also asked how to crop out the extra space in the axis. You can do this by changing the `constrain` parameter of the `xaxis` inside `Layout` to `"domain"`.

Here is an example in Pluto:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/3/6/36c6b468fc8a07b7fb94f59b6a6903acbfaeca9d.png)

And here is the code modified to use PlotlyJS as you do instead of PlutoPlotly.

```julia
using PlotlyJS
# Mesh
x = LinRange(-2.0, 2.0, 200)
y = LinRange(-1.0, 1.0, 100)
# One continuous field 
f = 1e3.*exp.(-x.^2 .- (y').^2)
# One discontinuous field 
g = zero(f)
g[(x.^2 .+ (y.^2)') .< 0.5^2] .= 1.0
# Compose figure
p = Plot([
	heatmap(x=x, y=y, z=f, colorscale=colors.plasma, colorbar_thickness=24), 
	contour(x=x, y=y, z=g', mode="lines", line_width=1, contours_coloring="none")],
	Layout(width=600, height=320,
		xaxis = attr(;
			range = [-2,2],
			constrain = "domain",
		),
		yaxis = attr(;
			range = [-1,1],
			scaleanchor = "x",
			scaleratio = 1,
		)
	))
display(p)

```

---

_[View the full topic](https://discourse.julialang.org/t/plotlyjs-and-composite-figures/97320)._
