Message Boards Message Boards


[NB] COVID19 Confirmed Cases: US Counties

Posted 1 year ago
11 Replies
7 Total Likes

MODERATOR NOTE: coronavirus resources & updates:

11 Replies
Posted 1 year ago

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

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

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;

  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}]

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 and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

Good catch! The notebook is revised. Tnx!

Posted 1 year 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.

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

Posted 1 year 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?

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

    Black], {GeoStyling[cfunc[#2]], 
          ", California, United States"], #2}]]} & @@@ coCases}, 
  PlotLabel -> "COVID19 cases in California", 
  ImageSize -> Large], legend]

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 1 year ago

Thanks for the workaround, @Mads Bahrami!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract