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

Consistent hot/cold spot colors for local moran #185

Merged
merged 5 commits into from
Aug 31, 2024

Conversation

weikang9009
Copy link
Member

This PR is to

Before:
image
After:
WeChatb5f0ad4484b9f0ad4cb9ade1f9d6c4a9

Copy link
Member

@martinfleis martinfleis left a comment

Choose a reason for hiding this comment

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

Fine with this but we should probably move these plotting functions to esda anyway.

@jGaboardi
Copy link
Member

Fine with this but we should probably move these plotting functions to esda anyway.

Agreed.

@knaaptime
Copy link
Member

nice. I actually thought this was already fixed. The other thing we need to fix is ensuring a square axis. The current implementation always elongates the Y to make it look like the slope of the regression line is 1.

+1 on the move. We should probably start a plotting branch in esda soon

@martinfleis
Copy link
Member

The other thing we need to fix is ensuring a square axis. The current implementation always elongates the Y to make it look like the slope of the regression line is 1.

You sure about that? right now the scale of units along x and y is the same. If you enforce square axis, this would get distorted.

@knaaptime
Copy link
Member

yes. look at weis figure
Screenshot 2024-08-31 at 11 15 14 AM

the distance between 0 and 2 on y is not the same as on x. The slope of that line is not 1, but it looks like it is because the y is squished

@knaaptime
Copy link
Member

checkout cell 6 in the splot docs https://nbviewer.org/github/pysal/splot/blob/main/notebooks/esda_morans_viz.ipynb

that slope is supposed to be .35

Screenshot 2024-08-31 at 11 20 54 AM

@martinfleis
Copy link
Member

the distance between 0 and 2 on y is not the same as on x.

Sorry to disagree, but it is.

Screenshot 2024-08-31 at 20 49 02

The slope is wrong but the axes and the scatter are correct.

They are not the same on the subplot within plot_moran but they are the same on moran_scatterplot.

So, I believe that:

  1. on moran_scatterplot we need to fix the visualisation of the slope.
  2. on plot_moran we need to ensure that scale of x and y is the same (ax.set_aspect('equal')) and fix the visualisation of the slope

@knaaptime
Copy link
Member

lol ok yes, bad example

i'm still confident there's still an issue that all the moran plots in splot and up with a slope that appears to be 1

@martinfleis
Copy link
Member

yeah, slope is wrong on all of these

@martinfleis martinfleis merged commit e4709f9 into pysal:main Aug 31, 2024
8 checks passed
@martinfleis
Copy link
Member

I moved the discussion on regression line to #186. I have also figured out why it is wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants