Message Boards Message Boards

[NB] COVID19 Confirmed Cases: US Counties

MODERATOR NOTE: coronavirus resources & updates: https://wolfr.am/coronavirus


POSTED BY: Mads Bahrami
11 Replies
Posted 4 years ago

Thanks for the workaround, @Mads Bahrami!

POSTED BY: David G

It is a bug, reported and hopefully will be resolved soon. So color functions and etc in my codes are good.I revised the notebook accordingly

POSTED BY: Mads Bahrami

Thanks @David G . I will resolve the issue soon (very busy workload today). Quick solution for now:

Legended[GeoGraphics[{EdgeForm[
    Black], {GeoStyling[cfunc[#2]], 
      Tooltip[Polygon[#1], 
       Column[{StringDelete[CommonName[#1], 
          ", California, United States"], #2}]]} & @@@ coCases}, 
  PlotLabel -> "COVID19 cases in California", 
  ImageSize -> Large], legend]
POSTED BY: Mads Bahrami
Posted 4 years ago

I believe there is something wrong with the way GeoRegionValuePlot is displaying colors for some counties. For example if you look at Sonoma county, the confirmed cases is 192 (as of 4/23/2020), but the color doesn't match. There are other counties that show the same issue. Can you explain this?

POSTED BY: David G
Posted 4 years ago

Hi Mads,

I added the following code to show data for any state using Manipulate.

cases[state_] := 
  ResourceData["Epidemic Data for Novel Coronavirus COVID-19", "USCounties"][
    Select[#State == state &], {#County, #ConfirmedCases["LastValue"]} &] // Normal;

Manipulate[
  GeoRegionValuePlot[Rule @@@ cases[state], 
  GeoLabels -> (Tooltip[#1, Column[{First@CanonicalName@#2, #4}]] &), 
  ColorFunction -> cfunc,
  ColorFunctionScaling -> False, 
  PlotLegends -> legend, 
  PlotLabel -> "COVID19 cases in " <> First@CanonicalName@state, 
  ImageSize -> Large], 
 {state, EntityClass["AdministrativeDivision", "USStatesAllStates"] // EntityList,
   ControlType -> PopupMenu}]
POSTED BY: Rohit Namjoshi
Posted 4 years ago

I made a copy before you fixed the issue with Which. Latest version works fine. Thanks!

POSTED BY: Rohit Namjoshi

Hmmm, I tried on cloud, and it works fine. On cloud, click on "Evaluation", then "Quit Kernel", and then "Evaluate All Cells".

POSTED BY: Mads Bahrami
Posted 4 years ago

Hi Mads,

I made a copy of your notebook in my cloud account. When I run it I get

Which::argctu: Which called with 1 argument.

Looks like the definition of cfunc is not right.

POSTED BY: Updating Name

Good catch! The notebook is revised. Tnx!

POSTED BY: Mads Bahrami
Posted 4 years ago

It appears that Which[] should be replaced by Which@@.

POSTED BY: Updating Name

enter image description here -- you have earned Featured Contributor Badge enter image description here

Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: Moderation Team
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract