Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Low resolution for contourf #297

Open
natefoulk4 opened this issue Jun 3, 2022 · 1 comment
Open

Low resolution for contourf #297

natefoulk4 opened this issue Jun 3, 2022 · 1 comment

Comments

@natefoulk4
Copy link

natefoulk4 commented Jun 3, 2022

Hello,

When I plot the following,

using Plots
pgfplotsx()
a = 0:0.1:1.0; 
b = 0:0.1:1.0;
contour(a, b, (x,y) -> exp(-(x-0.5)^2 - (y-0.5)^2))
contourf(a, b, (x,y) -> exp(-(x-0.5)^2 - (y-0.5)^2))

, the plots look qualitatively different.

Screen Shot 2022-06-03 at 3 17 34 PMScreen Shot 2022-06-03 at 3 18 11 PM

Is this expected? I would love to have nicer looking output for contourf

System info:

Julia Version 1.7.0
Commit 3bf9d17731 (2021-11-30 12:12 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin21.1.0)
  CPU: Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, cyclone)

[8314cec4] PGFPlotsX v1.5.0
[91a5bcdd] Plots v1.25.4
@fhouser
Copy link

fhouser commented Oct 22, 2022

@natefoulk4
Hi,
you could use heatmap() for the full resolution of your data's range. Or, set the 'levels' attribute in 'contourf': e.g.
contourf(a, b, (x,y) -> exp(-(x-0.5)^2 - (y-0.5)^2), levels = 25)
This will increase the so-called 'resolution'.

On a similar note: How did you manage to set contourf up? I can plot using contour and this backend, but using contourf results in the following error message on my system:

julia> contourf(a, b, (x,y) -> exp(-(x-0.5)^2 - (y-0.5)^2)) Error showing value of type Plots.Plot{Plots.PGFPlotsXBackend}: ERROR: ArgumentError: No tex function available for data of type ColorGradient. Define one by overloading print_tex(io::IO, data::T) where T is the type of the data to dispatch on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants