Wolfram Language

Novos domínios de visualização

Layout de linha do tempo e colocação de legendas

Crie linhas de tempo para as pessoas famosas no período do Romantismo.

In[1]:=
Click for copyable input
romanticerapeople = DeleteCases[ EntityValue[ Entity["HistoricalPeriod", "RomanticEra"][ "PeopleInvolved"], {"BirthDate", "DeathDate", "Name", "Image", "Occupation"}], {__, _Missing}];
In[2]:=
Click for copyable input
lifespan = GroupBy[romanticerapeople, Last -> (Tooltip[ Labeled[Interval@#[[1 ;; 2]], #[[3]], "StartBubble"], Labeled[#[[4]], DateDifference[#[[1]], #[[2]], "Year"]]] &)];

Mostre cada compositor em sua própria linha.

In[3]:=
Click for copyable input
TimelinePlot[lifespan[{"composer"}], PlotLayout -> "Stacked", LabelStyle -> 12, ImageSize -> 550, PlotLabel -> "Romantic Era Composers", PlotTheme -> "Grid"]
Out[3]=

Use o número mínimo de linhas.

In[4]:=
Click for copyable input
TimelinePlot[lifespan[{"composer"}], PlotLayout -> "Grouped", LabelStyle -> 12, ImageSize -> 550, PlotLabel -> "Romantic Era Composers", PlotTheme -> "Grid"]
Out[4]=

Coloque a legenda no final do intervalo de tempo.

In[5]:=
Click for copyable input
lifespan = GroupBy[romanticerapeople, Last -> (Tooltip[ Labeled[Interval@#[[1 ;; 2]], #[[3]], "EndBubble"], Labeled[#[[4]], DateDifference[#[[1]], #[[2]], "Year"]]] &)];
In[6]:=
Click for copyable input
TimelinePlot[lifespan[{"composer"}], LabelStyle -> 12, ImageSize -> 550, PlotLabel -> "Romantic Era Composers", PlotTheme -> "Grid"]
Out[6]=

Quando há muitas entradas de dados e o espaço é limitado, coloque a legenda depois dos intervalos.

In[7]:=
Click for copyable input
lifespan = GroupBy[romanticerapeople, Last -> (Tooltip[Labeled[Interval@#[[1 ;; 2]], #[[3]], After], Labeled[#[[4]], DateDifference[#[[1]], #[[2]], "Year"]]] &)];
In[8]:=
Click for copyable input
TimelinePlot[Values@lifespan, PlotLayout -> "Grouped", LabelStyle -> 14, AspectRatio -> 1/1.2, ImageSize -> 450, PlotLegends -> LineLegend[Flatten@Keys[lifespan], LegendLayout -> "ReversedColumn"], PlotTheme -> "Web"]
Out[8]=

Use um layout compacto em todos os conjuntos de dados.

In[9]:=
Click for copyable input
TimelinePlot[Values@lifespan, PlotLayout -> "Packed", LabelStyle -> 14, AspectRatio -> 1/1.2, ImageSize -> 450, PlotLegends -> LineLegend[Flatten@Keys[lifespan], LegendLayout -> "ReversedColumn"], PlotTheme -> "Web"]
Out[9]=

Exemplos Relacionados

de en es fr ja ko ru zh