Timeline for Customizing X-axis label for groups of 7 (weeks)
Current License: CC BY-SA 3.0
19 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 14, 2015 at 23:15 | comment | added | kglr | @penguin77, much neater too. I am glad penguins persevere; i learned something really cool. Thank you!! | |
Apr 14, 2015 at 23:09 | comment | added | penguin77 |
@kguler, I know, it's not a requirement of q/a. Anyhow DayRange[First@First@#, First@Last@#, Wednesday]&[wd] is about 100 times faster.....told me the penguins....:)
|
|
Apr 14, 2015 at 23:01 | history | edited | kglr | CC BY-SA 3.0 |
added 219 characters in body
|
Apr 14, 2015 at 19:57 | comment | added | penguin77 |
@kguler your Pick looks now nice and elegant. Pick is usually faster than Select , however requires a Map in this case. Evaluating this example with a data set of a 10 years period Pick still wins over Select in a "head-to-head" race being 0.3443 percent faster. So you are right! :). thx for insights
|
|
Apr 14, 2015 at 19:29 | comment | added | kglr |
@penguin77, it is not a requirement in this q/a, but Pick is usually faster than Select . Also, in this case, you save a single character using Select[DateRange@@wd[[;;,1]][[{1,-1}]],DayName@#==Wednesday&] versus Pick[#,DayName/@#,Wednesday]&[DateRange@@wd[[;;,1]][[{1,-1}]]] :)
|
|
Apr 14, 2015 at 15:10 | comment | added | penguin77 |
@kguler, yes indeed, this is looks more straightforward than NestList and DatePlus , that I have proposed and leads to Select[DateRange[dset[[1, 1]], dset[[-1, 1]]] , DayMatchQ[#, Wednesday] &] (being shorter)
|
|
Apr 14, 2015 at 14:03 | history | edited | kglr | CC BY-SA 3.0 |
added 520 characters in body
|
Apr 14, 2015 at 13:51 | comment | added | kglr |
@penguin77, you are right; I assumed there are no gaps in the data. If there are gaps ticks and gridlines can be off, so can the splitting into weeks. A more robust way would be to use DateRange of the data to identify Wednesday and Sunday dates:, e.g., wednesdays = Pick[DateRange[wd[[1, 1]], wd[[-1, 1]]], DayName /@ DateRange[wd[[1, 1]], wd[[-1, 1]]], Wednesday]; sundays = Pick[DateRange[wd[[1, 1]], wd[[-1, 1]]], DayName /@ DateRange[wd[[1, 1]], wd[[-1, 1]]], Sunday];
|
|
Apr 14, 2015 at 13:27 | comment | added | penguin77 | @kguler when trying wd = WeatherData["WMO89009", "Temperature", {"Jun. 1, 2014", "Dec. 1, 2014", "Day"}]; proposed solution seems not to work (see missing grid line between week 6 and 7 and gap in week 8). It looks like that ticks and GridLines are dependent on data being systematically available for Sundays and Wednesday. Or am I missing something ? | |
Apr 13, 2015 at 14:41 | vote | accept | K7PEH | ||
Apr 13, 2015 at 8:28 | history | edited | kglr | CC BY-SA 3.0 |
added 91 characters in body
|
Apr 13, 2015 at 8:16 | history | edited | kglr | CC BY-SA 3.0 |
added 653 characters in body
|
Apr 12, 2015 at 21:27 | history | edited | Mr.Wizard | CC BY-SA 3.0 |
added 86 characters in body
|
Apr 12, 2015 at 21:10 | comment | added | Mr.Wizard | It looks like we have an incompatible change. Do you have time to Chat? | |
Apr 12, 2015 at 21:08 | comment | added | kglr | @MrWizard, i am using version 9.0.1.0 (windows 8 64bit). | |
Apr 12, 2015 at 21:07 | comment | added | Mr.Wizard |
Are you using 10.1? In 10.0.2 this throws errors. wd[[All, 1]] is not valid.
|
|
Apr 12, 2015 at 21:01 | history | edited | kglr | CC BY-SA 3.0 |
added 47 characters in body
|
Apr 12, 2015 at 20:52 | history | edited | kglr | CC BY-SA 3.0 |
added 30 characters in body
|
Apr 12, 2015 at 20:43 | history | answered | kglr | CC BY-SA 3.0 |