Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Left ventricle bull eye #3518

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

Merged
merged 4 commits into from
Jun 23, 2015
Merged

Left ventricle bull eye #3518

merged 4 commits into from
Jun 23, 2015

Conversation

curiale
Copy link
Contributor

@curiale curiale commented Sep 15, 2014

In this example we create the bull eye representation for the left ventricle according to the American Heart Association (AHA)

In this example we create the bull eye representation for the left ventricle according to the American Heart Association (AHA)
@tacaswell tacaswell added this to the v1.5.x milestone Sep 15, 2014
@tacaswell
Copy link
Member

Thanks!

Could you also provide some synthetic data in-line and have it actually make a plot? The figure will be automatically saved and included in the documentation.

@WeatherGod
Copy link
Member

There are a bunch of extraneous blank spaces. I would also reduce the scope of the function by having it focus strictly on the small task of plotting. Move all of the colobar, plt.show(), figure handling out of the function.

I also don't like to encourage optional returns. Either always return it, or not.

@curiale
Copy link
Contributor Author

curiale commented Sep 15, 2014

Following your suggestions, I made some changes. Let me know if it is ok for you.

@curiale
Copy link
Contributor Author

curiale commented Oct 3, 2014

Hi, please let me know if I need to do something else.

import matplotlib.pyplot as plt


def bulleye_plot(data, ax, vlim=None, segBold=[]):
Copy link
Member

Choose a reason for hiding this comment

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

Can you make ax the first argument?

@amcveigh
Copy link

amcveigh commented Oct 5, 2014

This is potentially a superb solution for myself as a researcher and others.
I've been trying to modify the code to enable assignment of colours to the 17 segments.
In my study 8 subjects had heart motion scored in the same 17 segments on a scale of 1 (greatest motion) to 12 (least motion).
image

  1. I need a color scale appropriate for just 12 categories. A grayscale from Black at 1 to White at 12 or from Red to Blue as in this example.
  2. I also need to generate 1 plot for each patient so might be most efficient with a loop command.

I tried this by changing data in line 121 from
**Create the fake data
data = np.array(range(17)) + 1

to
**Create the fake data
data=np.array([12, 11,11,7,6,8,10,10,5,4,5,8,9,7,6,8,8])
acheiving this plot
lvplot

Do you have any suggestions as to how I might modify the code to achieve my aims? Apologies for naivety of the question. I am an R user used to graphing in ggplot and have just started to learn Python.

import matplotlib.pyplot as plt


def bullseye_plot(ax, data, vlim=None, segBold=[]):
Copy link
Member

Choose a reason for hiding this comment

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

This should be modified to take in a colormap specifier as in input.

@tacaswell
Copy link
Member

To control the color map limits, use the vlim kwarg on this function.

If you want to color the over/under values differently you can use the set_over and set_under properties of the color maps (http://matplotlib.org/examples/api/colorbar_only.html) but that will require changing the function a bit to be able to pass in what color map to use (which should be done anyway as jet is an awful color map (http://matplotlib.org/users/colormaps.html) ).

@curiale
Copy link
Contributor Author

curiale commented Oct 6, 2014

Your particular problem will be result using the vlim kwarg as tacaswell said in a previous reply. About the option to change the color map, I'll take a look.

@jenshnielsen
Copy link
Member

I think this needs the option to change colormap otherwise 👍 from me

@curiale
Copy link
Contributor Author

curiale commented Dec 13, 2014

Please let me know if I can help you with anything else.

@tacaswell tacaswell modified the milestones: proposed next point release, next point release Feb 19, 2015
@tacaswell tacaswell mentioned this pull request Jun 23, 2015
@tacaswell tacaswell merged commit 0709202 into matplotlib:master Jun 23, 2015
@tacaswell
Copy link
Member

@curiale Thanks. Your work is now part of the public docs: http://matplotlib.org/devdocs/examples/pylab_examples/leftventricle_bulleye.html

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

Successfully merging this pull request may close these issues.

5 participants