|
11 | 11 | "cell_type": "markdown", |
12 | 12 | "metadata": {}, |
13 | 13 | "source": [ |
14 | | - "## Überblick\n", |
| 14 | + "## Overview\n", |
15 | 15 | "\n", |
16 | | - "Wir können visuelle Hinweise (Begrenzungslinien, schattierte Bereiche, Beschriftungen und Pfeile usw.) zu unseren Plots hinzufügen, um bestimmte Merkmale hervorzuheben. Bokeh bietet hierfür mehrere Annotationstypen. Um *Annotations* hinzuzufügen, erstellen wir normalerweise ein *Low-Level*-Objekt und fügen es mit `add_layout` unserem Diagramm hinzu. Schauen wir uns einige konkrete Beispiele an:" |
| 16 | + "We can add visual cues (boundary lines, shaded areas, labels and arrows, etc.) to our plots to emphasise certain features. Bokeh offers several annotation types for this purpose. To add annotations, we usually create a low-level object and add it to our diagram using `add_layout`. Let’s look at some concrete examples:" |
17 | 17 | ] |
18 | 18 | }, |
19 | 19 | { |
|
22 | 22 | "source": [ |
23 | 23 | "### Spans\n", |
24 | 24 | "\n", |
25 | | - "Spans sind vertikale oder horizontale Linien, für die die Spannweiten zwischen den Bemaßung angegeben werden kann, z.B.:" |
| 25 | + "Spans are vertical or horizontal lines for which the spans between the dimensions can be specified, for example:" |
26 | 26 | ] |
27 | 27 | }, |
28 | 28 | { |
|
428 | 428 | "cell_type": "markdown", |
429 | 429 | "metadata": {}, |
430 | 430 | "source": [ |
431 | | - "### Box Annotations\n", |
| 431 | + "### Box annotations\n", |
432 | 432 | "\n", |
433 | | - "Soll ein Bereich eines Diagramms hervorgehoben werden, so können diese mit `BoxAnnotation`, den Koordinateneigenschaften \n", |
| 433 | + "If an area of a diagram is to be highlighted, this can be done with `BoxAnnotation`, the coordinate properties\n", |
434 | 434 | "\n", |
435 | 435 | "* `top`\n", |
436 | 436 | "* `left`\n", |
437 | 437 | "* `bottom`\n", |
438 | 438 | "* `right`\n", |
439 | 439 | "\n", |
440 | | - "sowie Linien- und Fülleigenschaften das Erscheinungsbild konfiguriert werden.\n", |
| 440 | + "as well as line and fill properties to configure the appearance.\n", |
441 | 441 | "\n", |
442 | | - "Infinite Boxen können erstellt werden, indem die Koordinaten nicht angegeben werden. Wenn zum Beispiel `top` nicht angegeben ist, wird die Box immer bis zum oberen Rand des Plotbereichs angezeigt, unabhängig davon, ob ein Verschieben oder Zoomen stattfindet, z.B.:" |
| 442 | + "Infinite boxes can be created by not specifying the coordinates. For example, if `top` is not specified, the box is always displayed up to the top edge of the plot area, regardless of whether panning or zooming takes place, for example:" |
443 | 443 | ] |
444 | 444 | }, |
445 | 445 | { |
|
530 | 530 | "source": [ |
531 | 531 | "### Label\n", |
532 | 532 | "\n", |
533 | | - "Mit der Annotation `Label` können wir einzelne Beschriftungen einfach an Plots anbringen. Die anzuzeigende Position und der Text sind als `x`, `y` und `text` konfiguriert:\n", |
| 533 | + "With the `Label` annotation, we can easily attach individual labels to plots. The position to be displayed and the text are configured as `x`, `y` and `text`:\n", |
534 | 534 | "\n", |
535 | 535 | "``` Python\n", |
536 | 536 | "Label(x=10, y=5, text=\"Some Label\")\n", |
537 | 537 | "```\n", |
538 | 538 | "\n", |
539 | | - "Standardmäßig befinden sich die Einheiten im *data space*, aber `x_units` und `y_units` können auf `screen` gesetzt werden, um die Beschriftung relativ zur Zeichenfläche zu positionieren, und Labels können mit `x_offset` und `y_offset` positioniert werden.\n", |
| 539 | + "By default, the units are in the *data space*, but `x_units` and `y_units` can be set to `screen` to position the label relative to the drawing area, and labels can be positioned with `x_offset` and `y_offset`.\n", |
540 | 540 | "\n", |
541 | | - "`Label`-Objekte haben auch Standardtext-, Zeilen- (`border_line`) und Fülleigenschaften (`background_fill`). Die Linien- und Fülleigenschaften gelten für einen Begrenzungsrahmen um den Text:\n", |
| 541 | + "`Label` objects also have standard text, line (`border_line`) and fill (`background_fill`) properties. The line and fill properties apply to a bounding box around the text:\n", |
542 | 542 | "\n", |
543 | 543 | "``` Python\n", |
544 | 544 | "Label(x=10, y=5, text=\"Some Label\", text_font_size=\"12pt\", \n", |
|
618 | 618 | "source": [ |
619 | 619 | "### LabelSet\n", |
620 | 620 | "\n", |
621 | | - "Mit der Annotation `LabelSet` könnt ihr viele Beschriftungen gleichzeitig erstellen, z.B. wenn ihr einen ganzen Satz von Scatter Markers beschriften möchtet. Sie ähneln `Label`, können aber auch eine `ColumnDataSource` als `source` -Eigenschaft nutzen, wobei sich `x` und `y` auf Spalten in der Datenquelle beziehen." |
| 621 | + "With the `LabelSet` annotation, you can create many labels at the same time, for example if you want to label a whole set of scatter markers. They are similar to `Label`, but can also use a `ColumnDataSource` as a `source` property, where `x` and `y` refer to columns in the data source." |
622 | 622 | ] |
623 | 623 | }, |
624 | 624 | { |
|
714 | 714 | "source": [ |
715 | 715 | "### Arrows\n", |
716 | 716 | "\n", |
717 | | - "Mit der Annotation `Arrow` könnt ihr auf verschiedene Elemente in eurer Zeichnung *zeigen+. Dies kann besonders bei Beschriftungen hilfreich sein.\n", |
| 717 | + "You can use the `Arrow` annotation to point to various elements in your drawing. This can be particularly helpful for labelling.\n", |
718 | 718 | "\n", |
719 | | - "So könnt ihr beispielsweise einen Pfeil erstellen, der von `(0,0)` bis `(1,1)` zeigt:\n", |
| 719 | + "For example, you can create an arrow that points from `(0,0)` to `(1,1)`:\n", |
720 | 720 | "\n", |
721 | 721 | "``` Python\n", |
722 | 722 | "p.add_layout(Arrow(x_start=0, y_start=0, x_end=1, y_end=0))\n", |
723 | 723 | "```\n", |
724 | 724 | "\n", |
725 | | - "Dieser Pfeil hat die Standardspitze [OpenHead](https://docs.bokeh.org/en/latest/docs/reference/models/annotations.html#bokeh.models.OpenHead). Andere Arten von Pfeilspitzen sind [NormalHead](https://docs.bokeh.org/en/latest/docs/reference/models/annotations.html#bokeh.models.NormalHead) und [VeeHead](https://docs.bokeh.org/en/latest/docs/reference/models/annotations.html#bokeh.models.VeeHead). Der Typ des Pfeilkopfs kann durch die Eigenschaften `start` and `end` von `Arrow`-Objekten konfiguriert werden:\n", |
| 725 | + "This arrow has the standard [OpenHead](https://docs.bokeh.org/en/latest/docs/reference/models/annotations.html#bokeh.models.OpenHead) tip. Other types of arrowheads are [NormalHead](https://docs.bokeh.org/en/latest/docs/reference/models/annotations.html#bokeh.models.NormalHead) and [VeeHead](https://docs.bokeh.org/en/latest/docs/reference/models/annotations.html#bokeh.models.VeeHead). The type of arrowhead can be configured using the `start` and `end` properties of `Arrow` objects:\n", |
726 | 726 | "\n", |
727 | 727 | "``` Python\n", |
728 | 728 | "p.add_layout(Arrow(start=OpenHead(), end=VeeHead(), \n", |
729 | 729 | " x_start=0, y_start=0, x_end=1, y_end=0))\n", |
730 | 730 | "```\n", |
731 | 731 | "\n", |
732 | | - "Dies erzeugt einen Doppelpfeil mit `OpenHead` und `VeeHead`. Pfeilspitzen haben darüberhinaus den Standardsatz von Linien- und Fülleigenschaften, um deren Aussehen zu konfigurieren, z.B.:\n", |
| 732 | + "This creates a double arrow with `OpenHead` and `VeeHead`. Arrowheads also have the standard set of line and fill properties to configure their appearance, for example\n", |
733 | 733 | "\n", |
734 | 734 | "``` Python\n", |
735 | 735 | "OpenHead(line_color=\"firebrick\", line_width=4)\n", |
736 | 736 | "```\n", |
737 | 737 | "\n", |
738 | | - "Der Code und das Diagramm unten zeigen mehrere dieser Konfigurationen zusammen." |
| 738 | + "The code and diagram below show several of these configurations together." |
739 | 739 | ] |
740 | 740 | }, |
741 | 741 | { |
|
851 | 851 | "cell_type": "markdown", |
852 | 852 | "metadata": {}, |
853 | 853 | "source": [ |
854 | | - "### Legenden\n", |
| 854 | + "### Legends\n", |
855 | 855 | "\n", |
856 | | - "Wenn Diagramme mehrere Glyphen enthalten, ist es wünschenswert, eine Legende hinzuzufügen, um Betrachtern die Interpretation zu erleichtern. Bokeh kann Legenden anhand der hinzugefügten Glyphen leicht generieren." |
| 856 | + "When diagrams contain multiple glyphs, it is desirable to add a legend to help viewers interpret them. Bokeh can easily generate legends based on the added glyphs." |
857 | 857 | ] |
858 | 858 | }, |
859 | 859 | { |
860 | 860 | "cell_type": "markdown", |
861 | 861 | "metadata": {}, |
862 | 862 | "source": [ |
863 | | - "#### Einfache Legenden\n", |
| 863 | + "#### Simple legends\n", |
864 | 864 | "\n", |
865 | | - "Im einfachsten Fall könnt ihr einen String als `legend` an eine Glyph-Funktion übergeben:\n", |
| 865 | + "In the simplest case, you can pass a string as a `legend` to a glyph function:\n", |
866 | 866 | "\n", |
867 | 867 | "``` Python\n", |
868 | 868 | "p.circle(x, y, legend=\"sin(x)\")\n", |
869 | | - "``` \n", |
| 869 | + "```\n", |
870 | 870 | "\n", |
871 | | - "In diesem Fall erstellt Bokeh automatisch eine Legende, die eine Darstellung dieser Glyphe zeigt." |
| 871 | + "In this case, Bokeh automatically creates a legend that shows a representation of this glyph." |
872 | 872 | ] |
873 | 873 | }, |
874 | 874 | { |
|
950 | 950 | "cell_type": "markdown", |
951 | 951 | "metadata": {}, |
952 | 952 | "source": [ |
953 | | - "#### Zusammengesetzte Legenden\n", |
| 953 | + "#### Composite legends\n", |
954 | 954 | "\n", |
955 | | - "Im obigen Beispiel haben wir für jede Glyphenmethode ein anderes Etikett bereitgestellt. Manchmal werden zwei (oder mehr) verschiedene Glyphen mit einer einzigen Datenquelle verwendet. In diesem Fall können zusammengesetzte Legenden erstellt werden. Wenn ihr z.B. eine Sin-Kurve mit einer Linie und einer Markierung plottet, könnt ihr ihnen dieselbe Bezeichnung geben um sie dazu zu bringen, gemeinsam in der Legende zu erscheinen:\n", |
| 955 | + "In the example above, we have provided a different label for each glyph method. Sometimes two (or more) different glyphs are used with a single data source. In this case, composite legends can be created. For example, if you plot a sin curve with a line and a marker, you can give them the same label to make them appear together in the legend:\n", |
956 | 956 | "\n", |
957 | 957 | "``` Python\n", |
958 | 958 | "p.circle(x, y, legend=\"sin(x)\")\n", |
|
964 | 964 | "cell_type": "markdown", |
965 | 965 | "metadata": {}, |
966 | 966 | "source": [ |
967 | | - "### Farbbalken\n", |
| 967 | + "### Colour bars\n", |
968 | 968 | "\n", |
969 | | - "Farbbalken sind besonders nützlich, wenn wir die Farbe einer Glyphe entsprechend der Farbzuordnung variiert. Bokeh-Farbbalken werden mit einer Farbzuordnung konfiguriert und mit der `add_layout'-Methode zu Plots hinzugefügt:\n", |
| 969 | + "Colour bars are particularly useful when we vary the colour of a glyph according to the colour mapping. Bokeh colour bars are configured with a colour mapping and added to plots using the `add_layout` method:\n", |
970 | 970 | "\n", |
971 | 971 | "``` Python\n", |
972 | 972 | "color_mapper = LinearColorMapper(palette=\"Viridis256\", low=data_low, high=data_high)\n", |
973 | 973 | "color_bar = ColorBar(color_mapper=color_mapper, location=(0,0))\n", |
974 | 974 | "p.add_layout(color_bar, 'right')\n", |
975 | 975 | "```\n", |
976 | 976 | "\n", |
977 | | - "Das folgende Beispiel zeigt ein vollständiges Beispiel, in dem auch die Farbzuordnung zur Umwandlung der Glyphenfarbe verwendet wird." |
| 977 | + "In the following example, the colour mapping is also used to convert the glyph colour." |
978 | 978 | ] |
979 | 979 | }, |
980 | 980 | { |
|
0 commit comments