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

Add cmap option to specify the colormap of plot #1788

Merged
merged 4 commits into from
Oct 25, 2021

Conversation

yuyizheng1112
Copy link
Contributor

This PR aims to allow the user to set specific color scale in the plot.
This should be merged after restructuring (#1777). Please see the changes in commit 2bc2e69.

Description

  • Add cmap option to display() method - It requires a string to specify the name of the color map. The default color scale is 'jet'.
  • Add plot_cmap attribute to widget class because the colormap string is also used in add element method.
  • Add docstrings for new attributes.

Examples

Default color scale:
截屏2021-08-20 上午12 18 52

Custom color scale:
截屏2021-08-20 上午12 19 33

Type of change

  • Bug fix.
  • New feature.
  • Breaking change.
  • None of the above.

Checklist

  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
    • (optional) I have built the documentation on my fork following the instructions.
  • I have assigned and requested two reviewers for this pull request.

@tardis-bot
Copy link
Contributor

Before a pull request is accepted, it must meet the following criteria:

  • Is the necessary information provided?
  • Is this a duplicate PR?
    • If a new PR is clearly a duplicate, ask how this PR is different from the original PR?
    • If this PR is about to be merged, close the original PR with a link to this new PR that solved the issue.
  • Does it pass existing tests and are new tests provided if required?
    • The test coverage should not decrease, and for new features should be close to 100%.
  • Is the code tidy?
    • No unnecessary print lines or code comments.

@codecov
Copy link

codecov bot commented Aug 27, 2021

Codecov Report

Merging #1788 (4b16138) into master (fa42fbc) will decrease coverage by 0.04%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1788      +/-   ##
==========================================
- Coverage   58.38%   58.34%   -0.05%     
==========================================
  Files          66       66              
  Lines        6705     6712       +7     
==========================================
+ Hits         3915     3916       +1     
- Misses       2790     2796       +6     
Impacted Files Coverage Δ
...s/tardis/visualization/widgets/custom_abundance.py 14.42% <0.00%> (-0.01%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fa42fbc...4b16138. Read the comment docs.

@atharva-2001 atharva-2001 marked this pull request as draft September 3, 2021 14:39
@jaladh-singhal jaladh-singhal marked this pull request as ready for review September 17, 2021 14:58
@sourcery-ai
Copy link

sourcery-ai bot commented Sep 17, 2021

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.44%.

Quality metrics Before After Change
Complexity 3.85 ⭐ 3.74 ⭐ -0.11 👍
Method Length 83.54 🙂 81.68 🙂 -1.86 👍
Working memory 9.83 🙂 9.76 🙂 -0.07 👍
Quality 63.30% 🙂 63.74% 🙂 0.44% 👍
Other metrics Before After Change
Lines 1613 1642 29
Changed files Quality Before Quality After Quality Change
tardis/visualization/widgets/custom_abundance.py 63.30% 🙂 63.74% 🙂 0.44% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
tardis/visualization/widgets/custom_abundance.py CustomAbundanceWidgetData.from_csvy 12 🙂 413 ⛔ 18 ⛔ 28.54% 😞 Try splitting into smaller methods. Extract out complex expressions
tardis/visualization/widgets/custom_abundance.py CustomAbundanceWidget.on_btn_add_shell 14 🙂 383 ⛔ 11 😞 36.17% 😞 Try splitting into smaller methods. Extract out complex expressions
tardis/visualization/widgets/custom_abundance.py CustomAbundanceWidget.create_widgets 1 ⭐ 537 ⛔ 13 😞 43.87% 😞 Try splitting into smaller methods. Extract out complex expressions
tardis/visualization/widgets/custom_abundance.py CustomAbundanceWidget.generate_abundance_density_plot 1 ⭐ 191 😞 16 ⛔ 49.11% 😞 Try splitting into smaller methods. Extract out complex expressions
tardis/visualization/widgets/custom_abundance.py DensityEditor.create_widgets 0 ⭐ 302 ⛔ 12 😞 49.51% 😞 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@andrewfullard andrewfullard merged commit e4637d6 into tardis-sn:master Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants