FlowingData Forums » Data Visualization

Help with Thematic Map

Started 2 years ago by amac / 7 posts

  1. I've been trying to modify the tutorial from:

    http://flowingdata.com/2009/11/12/how-to-make-a-us-county-thematic-map-using-free-tools/

    for my students.

    The goal is that they can turn in a .csv file similar with each line:

    CN010010,1,1,"Autauga County, AL",0

    They will then change the last number to the number of years they've lived in each county. But that's way off in the future.

    With no modifications to the tutorial code, I've zeroed out the last column in excel and then went back in and gave Orange County Florida a value of 12.4. When I run the python script, it leaves every single county gray for some reason.

    When I pull up the file in a text editor (TextMate, it does show values for all of the other counties as zero).

    Any ideas on why no matter what I change, I still get the original gray map?

  2. what happens when you use the CSV in the tutorial?

  3. I tried using the original code and the original csv. Everything works great.

    I tried making the CVS reset to close to zero and then it starts throwing issues. This is what I currently have it as:

    http://spreadsheets.google.com/ccc?key=0An12JrDtOrO_dG1rdlFmbHpXS0Fua3hHdFYtblJ0NGc&hl=en

    For some reason 0's in the last column were disappearing so it set is as 0.1 to preserve some values in that row.

    But when I run that in your code, it cause the map to get gray and white. This shouldn't happen based on all the values except for 2 being 0.1, correct?

  4. you need to have the leading zeros in the second and third columns.

  5. Thanks.

    Is there a way to make Excel keep the leading zeros in the csv?

    I'm trying to make this as painless for my students as possible.

    My current way involves:
    - Students adding years to each county + the max unemployment #
    - A butchered version of the python script in which any number from the orginal unemployment set gets set as white. From there I make the increments for color into 3's all the way up to (max unemployment)+18.

    Thoughts on ways I could make this easier for them?

  6. I think if you "format cells" in Excel and set the data type to string (or word?) instead of general or number, it'll keep the leading zeros when you save it as a CSV.

  7. If you set the data type to "text" it should keep the zeros. In some instances I've seen it not work when importing data, though, so it might require some creativity.

    However, this could cause problems down the line if the data needs to be a number later on in the process.


Reply

You must log in to post.

About this Topic

Tags

No tags yet.