ScientiaFelis / sebmsR

Swedish Butterflies - tools and apps
GNU Affero General Public License v3.0
2 stars 0 forks source link

abundance_year_compare does not save #23

Closed larspett closed 1 year ago

larspett commented 1 year ago

when using this for 2021:2022, it displays a correct image but throws an error instead of saving the graph image

ScientiaFelis commented 1 year ago

Cannot reproduce error!?

larspett commented 1 year ago

Works on osx, error on win10

From: Georg @.> Reply to: ScientiaFelis/sebmsR @.> Date: Monday, 30 October 2023 at 17:56 To: ScientiaFelis/sebmsR @.> Cc: Lars Pettersson @.>, Author @.***> Subject: Re: [ScientiaFelis/sebmsR] abundance_year_compare does not save (Issue #23)

Cannot reproduce error!?

— Reply to this email directly, view it on GitHubhttps://github.com/ScientiaFelis/sebmsR/issues/23#issuecomment-1785661114, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEVQXZHWJ3WNCI4GWXDXA63YB7L4NAVCNFSM6AAAAAA6V6EA26VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBVGY3DCMJRGQ. You are receiving this because you authored the thread.Message ID: @.***>

ScientiaFelis commented 1 year ago

Not sure how to fix the win10 error. Do you have any idea of what is causing it?

The font error perhaps could be fixed by having Arial installed, which it should be, then import it in R with:

extrafont::font_import()

And perhaps

extrafont::loadfonts(device = "pdf", quiet = TRUE)
extrafont::loadfonts(device = "postscript", quiet = TRUE)
extrafont::loadfonts(device = "win", quiet = TRUE)
larspett commented 1 year ago

Will try again. Arial is there so that shouldn’t be the problem

31 okt. 2023 kl. 08:39 skrev Georg @.***>:



Not sure how to fix the win10 error. Do you have any idea of what is causing it?

The font error perhaps could be fixed by having Arial installed, which it should be, then import it in R with:

extrafont::font_import()

And perhaps

extrafont::loadfonts(device = "pdf", quiet = TRUE) extrafont::loadfonts(device = "postscript", quiet = TRUE) extrafont::loadfonts(device = "win", quiet = TRUE)

— Reply to this email directly, view it on GitHubhttps://github.com/ScientiaFelis/sebmsR/issues/23#issuecomment-1786654420, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEVQXZHRUPHHF2SPENUCRADYCCTJRAVCNFSM6AAAAAA6V6EA26VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBWGY2TINBSGA. You are receiving this because you authored the thread.Message ID: @.***>

larspett commented 1 year ago

It didn't throw the font error messages now but I believe that was because I ran sebms_species_per_sitetype_plot(year=2022) first and got the errors (of the session) there. Or - maybe not. I restarted R now and ran sebms_abundance_year_compare_plot(year = 2021:2022) but didn't get any font errors. The fonts look ok too (which they don't in the sebms_species_per_sitetype_plot() .

However, on my windows machine, it writes an empty "Butterflynumber_2021" (0kB) with no suffix. I think my Mac did write a proper graph yesterday.

larspett commented 1 year ago

Unlikely that the save fail is a mac thing. I tried testing on my laptop now but Box Sync with my R files isn't up to date so that will take a while, But it is more likely that there is a bug in that function and that I was wrong when I thought I saw it being created on my mac at home ping @ScientiaFelis

ScientiaFelis commented 1 year ago

Ok, that is odd. I will see if I can figure out what is wrong

larspett commented 1 year ago

It saved nicely on a mac but fails on a PC, still making a 0 kB file with no suffix. The built png cuts the top Y axis value (18000) so needs to be fixed.

There is something funny about the week numbers too. compare these two, one from the last report and one from the package sebmsr20-21 report-20-21

ScientiaFelis commented 1 year ago

I think that the empty file actually can result from missing fonts.

I will check the weeks, seems to be one week off to the right?

larspett commented 1 year ago

Ok, yes it looks so

From: Georg @.> Sent: den 31 oktober 2023 17:44 To: ScientiaFelis/sebmsR @.> Cc: Lars Pettersson @.>; Author @.> Subject: Re: [ScientiaFelis/sebmsR] abundance_year_compare does not save (Issue #23)

I think that the empty file actually can result from missing fonts.

I will check the weeks, seems to be one week off to the right?

— Reply to this email directly, view it on GitHubhttps://github.com/ScientiaFelis/sebmsR/issues/23#issuecomment-1787593959, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEVQXZCG2YK742UH7IENPP3YCETG3AVCNFSM6AAAAAA6V6EA26VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBXGU4TGOJVHE. You are receiving this because you authored the thread.Message ID: @.**@.>>

ScientiaFelis commented 1 year ago

Is this still failing @larspett ?

larspett commented 1 year ago

No font error thrown bit does not save

larspett commented 1 year ago

The errors are still there, 11 + 18 of them

There were 11 warnings (use warnings() to see them)

warnings() Warning messages: 1: In grid.Call(C_stringMetric, as.graphicsAnnot(x$label)) : font family not found in Windows font database 2: In grid.Call(C_stringMetric, as.graphicsAnnot(x$label)) : font family not found in Windows font database 3: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 4: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 5: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 6: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 7: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 8: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 9: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 10: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 11: In grid.Call.graphics(C_text, as.graphicsAnnot(x$label), ... : font family not found in Windows font database There were 18 warnings (use warnings() to see them) warnings() Warning messages: 1: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 2: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 3: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 4: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 5: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 6: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 7: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 8: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 9: In grid.Call.graphics(C_text, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 10: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 11: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 12: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 13: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 14: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 15: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 16: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 17: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), ... : font family not found in Windows font database 18: In grid.Call.graphics(C_text, as.graphicsAnnot(x$label), ... : font family not found in Windows font database

larspett commented 1 year ago

and the png is still 0 kB

ScientiaFelis commented 1 year ago

I think it is fixed in the latest push. I had forgot a bugtracer in the code. Strange that it worked at all

larspett commented 1 year ago

Butterflynumber is still 0 kB in latest version (1.4.7)

ScientiaFelis commented 1 year ago

I cannot see why. It is still a Windows problem right?

ScientiaFelis commented 1 year ago

Replace : to - in file names Windows should be able to handle it now.