Skip to content

Showing a figure with a Graphics entry with a relative path fails #283

@KristofferC

Description

@KristofferC

Reported from slack

using PGFPlotsX
using KernelDensity
using ColorSchemes

data = (rand(1000), rand(1000))

k = kde(data)

npoints = 400
es = map(extrema, data)
rgs = map(e -> range(e...; length=npoints), es)
res = pdf(k, rgs...)

res = reverse(transpose(res), dims = 1)

cs = get(ColorSchemes.jet1, res, (minimum(res), maximum(res)))

PNGFiles.save("img.png", cs)

figure = Axis(
	PGFPlotsX.Options(
		:enlargelimits => "false",
		:axis_on_top => nothing,
	),
	Plot(
		PGFPlotsX.Graphics(
			PGFPlotsX.Options(
				:xmin => first(k.x),
				:xmax => last(k.x),
				:ymin => first(k.y),
				:ymax => last(k.y),
			),
			"img.png"
		)
	)
)

fails to show the figure because I guess we put the .tex file in a temp folder. I think we need to put it in the same folder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions