-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
Add contourplot
#204
Add contourplot
#204
Conversation
This should be easier to review now, no code style change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice implementation. I never used Contour before so I don't know how performant it's used in practice. Did you happen to run some real-world examples on this and ensure that it draws within a reasonable time limit?
Well in #204 (comment) I've compared it against heatmap, I've been using it for a week within my CFD codes (example lid driven cavity in Images: using BenchmarkTools, UnicodePlots, TestImages
main() = begin
img = map(Float64, testimage("cam")) # 512x512
@btime contourplot($img, levels=1) # 78.073 ms (779057 allocations: 30.02 MiB)
@btime heatmap($img) # 528.955 ms (6558842 allocations: 264.27 MiB)
end
main() |
Co-authored-by: Johnny Chen <johnnychen94@hotmail.com>
Codecov Report
@@ Coverage Diff @@
## master #204 +/- ##
==========================================
- Coverage 99.65% 99.57% -0.09%
==========================================
Files 23 24 +1
Lines 1167 1179 +12
==========================================
+ Hits 1163 1174 +11
- Misses 4 5 +1
Continue to review full report at Codecov.
|
@johnnychen94, quick question about drawing images: what is the convention ? |
7cccec4
to
e3cdcef
Compare
43e22f1
to
6bdf1d1
Compare
From my own experience in image processing, the rotated x-y axis are used so that top-left point is the origin: JuliaImages/juliaimages.github.io#173 Also, because the Julia array is column-major order, the first dimension (x axis) specifies the height instead of the width. I would try to use the i-th dimension whenever the x/y notation introduces ambiguities. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clearly, you know more of the plot ecosystem than I do, so my comments here are just double checks from a user's perspective. I'll leave it to you to decide if it's ready to merge.
This means that in julia libraries, input images are stored as regular matrices (origin at North-West, column major), which makes sense. This is ambiguous for us since (transpose + reverse 1st dim)
|
I think this is pretty clear to me, and from a user point of view:
And if that doesn't suit someone, they can always use the explicit |
c3ae5a6
to
acfb36e
Compare
abe5b2c
to
eaa2cd7
Compare
Thank you again for consistently improving this package! |
I released it quickly so that I can move on JuliaPlots/Plots.jl#4031. I will rework the doc-strings now, and also add a formatting action since as as you reminded me in #199, mixing code style changes and regular changes is not a good idea for reviewing. |
contourplot
support (levels
,colormap
,colorbar
controls)Contour.jl
dependency for computing levels using theMarching_squares
algorithmblend
flag on all canvases to plot with/without color blend (avoid overlap issues on contour lines)https://github.com/JuliaGeometry/Contour.jl is a small requirement, since it only depends on
StaticArrays
.See examples at JuliaPlots/Plots.jl#4031.
The new example from
README.md
now looks like this (gaussian profile):tiny benchmark
Needs #203.