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

Assign different portions of a single colormap to different sub-colormaps #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ziyiyin97
Copy link
Member

This can create colormaps to show different layers in an image, e.g. Figure 2 in https://slim.gatech.edu/Publications/Public/Submitted/2022/yin2022TLEdgc/paper.html

@ziyiyin97 ziyiyin97 added the enhancement New feature or request label Oct 13, 2022
@@ -68,3 +68,10 @@ tight_layout()
# Wiggle plot
figure(figsize=(10, 5))
wiggle_plot(shot[1:5:end, 1:10:end], xloc[1:10:end], 0:0.02:4.6; new_fig=false)

# plot with multiple colorscales
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would appreciate an actual illustrative example like all the other ones that use proper images/shot records/.... because this doesn't really show anything.

Create a single colormap that assigns different portions of it to different sub-colormaps.

# Arguments
- `intervals::Vector{Tuple{T, T}}`: intervals of values where each interval will be assigned to a different colormap
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not super practical especially considering it plots with perc. Working with actual portion in % or something would be more user friendly.


# Arguments
- `intervals::Vector{Tuple{T, T}}`: intervals of values where each interval will be assigned to a different colormap
- `cmap_types::Vector{ColorMap}`: colormaps for each interval
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just cmaps

# Arguments
- `intervals::Vector{Tuple{T, T}}`: intervals of values where each interval will be assigned to a different colormap
- `cmap_types::Vector{ColorMap}`: colormaps for each interval
- `out_of_interval_color`: (Optional) the color assigned to values that live outside of all the intervals, default is black [0.,0.,0.,1.]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Someting like taht is usually just called padding

total_sections = vcat(cmap_sections[1], vcat([vcat(between_interval_sections[i], cmap_sections[i+1]) for i = 1:length(cmap_sections)-1]...))

# construct the colormaps
cmaps = matplotlib.colors.ListedColormap(total_sections)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks bit overly intricated but that's fine

@mloubout mloubout force-pushed the master branch 11 times, most recently from 0948c8a to e1bbd1d Compare May 31, 2023 12:29
@mloubout mloubout force-pushed the master branch 14 times, most recently from 962188f to be534a2 Compare October 28, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants