Message Boards Message Boards

GROUPS:

[NB] COVID19 Confirmed Cases: US Counties

Posted 7 months ago
1978 Views
|
11 Replies
|
7 Total Likes
|

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


11 Replies

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 7 months ago

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

Good catch! The notebook is revised. Tnx!

Posted 7 months 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 7 months ago

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

Posted 7 months 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 7 months 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:

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]

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 7 months ago

Thanks for the workaround, @Mads Bahrami!

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