MTgeophysics / mtpy

Python toolbox for standard Magnetotelluric (MT) data analysis
GNU General Public License v3.0
145 stars 66 forks source link

, the ellipses on the phase tensor plots seem to be shown with more gradations of colour than are shown in the colour bars. Please fix the colour bars. #79

Open WenpingGA opened 5 years ago

WenpingGA commented 5 years ago

Expected Behavior

Current Behavior

Possible Solution

Steps to Reproduce (for bugs)

1. 2. 3. 4.

# Paste your code here
#
#

Context

Your Environment

Installed Python Packages: use pip freeze or conda list [-n ENVIRONMENT_NAME] to list all the installed libraries.

alkirkby commented 5 years ago

Hi @WenpingGA, thanks for pointing this out. I had a quick look and is indeed an issue - when running mtpy/examples/scripts/plot_phase_tensor_section.py with ellipse_colorby=skew_seg and ellipse_range=[-12,12,6] the colour bar is showing up as segmented but if you look carefully at the ellipses there are in-between shades present. It might take some time for me to work this out. In the meantime, @kujaku11 or @rh-downunder are you able to look at it or do you have any ideas?

kujaku11 commented 5 years ago

The issue was in how the colors were made in mtcolors.get_plot_colors. I've a line that will convert the color based on the step and bounds given.

alkirkby commented 5 years ago

Cool thanks @kujaku11 for addressing this - however I think the colours still aren't quite right... when you look carefully the colors in the legend in the intermediate range (not min or max or near zero) are not quite the same as those in the legend... could you check?

kujaku11 commented 5 years ago

Not sure, it looks the same on my screen. It might be that there is an alpha that is used internally in matplotlib.patches.Ellipse that isn't matched in the color bar. I'm not sure if we can fix that.

kujaku11 commented 5 years ago

I just checked and the color tuples are the same for the color bar and the ellipses, so there must be some sort of rendering done internally in matplotlib that I'm not privy to.

geojunky commented 5 years ago

Just wondering if rasterizing the ellipses (rasterized=True) and the colorbar as well, as in here might help.