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

Added Chrolopleth map to the Heat Map dialog #7143

Merged

Conversation

EstherNjeriLiberatta
Copy link
Contributor

@EstherNjeriLiberatta EstherNjeriLiberatta commented Jan 20, 2022

Fixes #6782
In this PR I have made a few adjustments to the heatmap dialogue and added a choropleth map option as another button.
To test the choropleth map use the data set below.
mydata.csv

@rdstern @africanmathsinitiative/developers This is ready for review.

@EstherNjeriLiberatta EstherNjeriLiberatta changed the title Partially fixes issue # 6782 (Adding Choropleth map dialogue) Partially fixes issue #6782 (Adding Choropleth map dialogue) Jan 20, 2022
@lloyddewit
Copy link
Contributor

@N-thony Please could you review? thanks

instat/dlgHeatMapPlot.vb Outdated Show resolved Hide resolved
instat/dlgHeatMapPlot.vb Show resolved Hide resolved
instat/dlgHeatMapPlot.vb Outdated Show resolved Hide resolved
instat/dlgHeatMapPlot.vb Outdated Show resolved Hide resolved
instat/dlgHeatMapPlot.vb Outdated Show resolved Hide resolved
instat/dlgHeatMapPlot.vb Show resolved Hide resolved
instat/dlgHeatMapPlot.vb Show resolved Hide resolved
@EstherNjeriLiberatta
Copy link
Contributor Author

Thankyou @N-thony , I've made some of the changes you requested, kindly review. Thanks

@N-thony
Copy link
Collaborator

N-thony commented Feb 17, 2022

Thankyou @N-thony , I've made some of the changes you requested, kindly review. Thanks

@EstherNjeriLiberatta, we can have a quick call on this when you have time.

@EstherNjeriLiberatta
Copy link
Contributor Author

EstherNjeriLiberatta commented Feb 18, 2022

@N-thony thank you for your help so far on this dialogue.
The issue I'm having now is making the labels and points clearer. As of now, the choropleth map creates a map however with the addition of points and/or labels they seem to be messed up and clustered along the borders of each region. @rdstern has suggested having one point for each region from the Alabama dataset which will help with that. The images below give a description of how the dialogue and the map look without and with the Add labels checked respectively.
@HawardKetoyoMsatsi please could you help me out on this? Thank you.

image

image

image

image

@shadrackkibet
Copy link
Collaborator

@HawardKetoyoMsatsi happy to take over?

@HawardKetoyoMsatsi
Copy link
Contributor

@shadrackkibet yes I will fix this.

@EstherNjeriLiberatta
Copy link
Contributor Author

@HawardKetoyoMsatsi Thank you for helping out on this, I'll work with you to know how you fix the problem I was having.

@HawardKetoyoMsatsi
Copy link
Contributor

@EstherNjeriLiberatta I have managed to fix this error in R. Since you had already written the vb code once you have time we can add the R-code I wrote into your vb code together.

@EstherNjeriLiberatta
Copy link
Contributor Author

Thank you, @HawardKetoyoMsatsi Getting to you on skype.

@HawardKetoyoMsatsi
Copy link
Contributor

@EstherNjeriLiberatta How far with this task, Have you been able to add the R code I gave you in R-Instat.

@EstherNjeriLiberatta
Copy link
Contributor Author

Hello @lilyclements when running the code below I get the following error. What could the problem be in the code?

# Code generated by the dialog, Heat Map

mydata1 <- data_book$get_data_frame(data_name="mydata1")
cnames <- aggregate(cbind(x=long, y=lat) ~ murder, data=mydata1, FUN=function(x)  mean(range(x)))
last_graph <- ggplot2::ggplot(data=mydata1, mapping=ggplot2::aes(x=long, y=lat, fill=murder)) + ggplot2::geom_polygon(mapping=ggplot2::aes(group=group)) + ggplot2::geom_point(data=cnames, mapping=ggplot2::aes(size=murder, x=long, y=lat)) + theme_grey()
data_book$add_graph(graph_name="last_graph", graph=last_graph, data_name="mydata1")
data_book$get_graphs(data_name="mydata1", graph_name="last_graph")
rm(list=c("last_graph", "mydata1", "cnames"))

image

@lilyclements
Copy link
Contributor

@EstherNjeriLiberatta the error says "object 'long' not found".

You use "long" in the cbind function, and do not call it from the data frame. Can you show me all of the R output for this code? I am just wondering if you run long <- data_book$get_variables_from_data(...) or whichever the function is!

@EstherNjeriLiberatta
Copy link
Contributor Author

@lilyclements here is the R output
image

@lilyclements
Copy link
Contributor

Great, so you want to call long <- data_book$get_columns_from_data(...). To do this, you just have to run in the dialog code ucrSelectorLong.SetParameterIsRFunction, and similarly for the latitude selector.

@EstherNjeriLiberatta
Copy link
Contributor Author

Okay, thank you so much

@EstherNjeriLiberatta EstherNjeriLiberatta self-assigned this May 18, 2022
Co-authored-by: lloyddewit <57253949+lloyddewit@users.noreply.github.com>
EstherNjeriLiberatta and others added 7 commits July 18, 2022 12:38
Co-authored-by: lloyddewit <57253949+lloyddewit@users.noreply.github.com>
Co-authored-by: lloyddewit <57253949+lloyddewit@users.noreply.github.com>
Co-authored-by: lloyddewit <57253949+lloyddewit@users.noreply.github.com>
Co-authored-by: lloyddewit <57253949+lloyddewit@users.noreply.github.com>
Co-authored-by: lloyddewit <57253949+lloyddewit@users.noreply.github.com>
Co-authored-by: lloyddewit <57253949+lloyddewit@users.noreply.github.com>
@EstherNjeriLiberatta
Copy link
Contributor Author

@N-thony @africanmathsinitiative/developers This is ready for review.

instat/dlgHeatMapPlot.vb Outdated Show resolved Hide resolved
instat/dlgHeatMapPlot.vb Outdated Show resolved Hide resolved
instat/dlgHeatMapPlot.vb Outdated Show resolved Hide resolved
instat/dlgHeatMapPlot.vb Outdated Show resolved Hide resolved
Copy link
Contributor

@lloyddewit lloyddewit left a comment

Choose a reason for hiding this comment

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

@EstherNjeriLiberatta Thank you for the changes.
Please could you also look at the 2 unresolved comments from 10 July (see unresolved comments above)
Thanks

instat/dlgHeatMapPlot.vb Outdated Show resolved Hide resolved
@EstherNjeriLiberatta
Copy link
Contributor Author

@lloyddewit I hope I have resolved all the requested changes from you and @N-thony, thank you so much.
This is ready for review.

Copy link
Contributor

@lloyddewit lloyddewit left a comment

Choose a reason for hiding this comment

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

@EstherNjeriLiberatta This is looking really good, you've made some good quality improvements since the first commits.

I think we're very nearly ready to merge, just a couple of final questions.
Thank you for your patience

instat/dlgHeatMapPlot.vb Outdated Show resolved Hide resolved
instat/dlgHeatMapPlot.vb Show resolved Hide resolved
instat/dlgHeatMapPlot.vb Outdated Show resolved Hide resolved
instat/dlgHeatMapPlot.vb Outdated Show resolved Hide resolved
instat/dlgHeatMapPlot.vb Outdated Show resolved Hide resolved
lloyddewit and others added 5 commits July 21, 2022 09:08
Co-authored-by: lloyddewit <57253949+lloyddewit@users.noreply.github.com>
Co-authored-by: lloyddewit <57253949+lloyddewit@users.noreply.github.com>
@EstherNjeriLiberatta
Copy link
Contributor Author

@lloyddewit Thank you, I have made the changes.

@lloyddewit
Copy link
Contributor

@rdstern There are significant changes since your last approval. If you can test/approve again, then we can merge, thanks

@lloyddewit lloyddewit changed the title Fixes issue #6782 (Adding Choropleth map dialogue) Added Chrolopleth map to the Heat Map dialog Jul 31, 2022
@lloyddewit lloyddewit merged commit caece44 into IDEMSInternational:master Jul 31, 2022
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.

Adding Chrolopleth Map to the Heat Map Dialog.
7 participants