previous   Cheese and Lettuce onBus   next


An Artificial Neuron

This example illustrates setting line styles and adding text. The final image looks best as a pgf picture included in a LaTeX document, as then you can use maths fonts with subscripts.

  1. Select the rectangle tool , and create a rectangle, as shown in Figure 11.16.

    Figure 11.16: Artificial Neuron Example--Adding a Rectangle
    Image neuron1.png

  2. Select the ellipse tool , and create a circle, as shown in Figure 11.17.

    Figure 11.17: Artificial Neuron Example--Adding a Circle
    Image neuron2.png

  3. To make the logistic function symbol, select the open curve tool , and do a single segment (Figure 11.18(a)). Then use the edit path tool to adjust the curvature, as shown in Figure 11.18(b). (If you have enabled the grid lock, you may find it easier to disable it while you are editing the curvature control points.)

    Figure 11.18: Artificial Neuron Example--creating a sigmoidal curve: (a) adding an open curve segment; (b) edit segment to adjust curvature.
    Image neuron3a.png
    (a)
    Image neuron3b.png
    (b)

  4. Next set the current line style to have an end arrow. Note that lines with end markers look best with a butt cap style, so this should also be set. This can be done as follows:

    Use the Settings->Styles... menu item to display the current styles dialog box. Select the tab labelled Line Style to display the line style panel. Select Butt from the labelled Cap Style (see Figure 11.19). Next select the button labelled Select... located on the same row as End Marker to open the end marker dialog box (illustrated in Figure 11.20). Select the radio button labelled Use Marker. This will enable the marker chooser panel. Select the tab labelled Arrows and select Pointed 60. Select Okay to close the end marker dialog box and select Okay to close the styles dialog box.

    Figure 11.19: Artificial Neuron Example--Setting the Current Line Style
    Image neuronlinestyle.png

    Figure 11.20: Artificial Neuron Example--End Marker Dialog Box
    Image neuronendmarker.png

  5. Select the open line tool , and add in the arrows as illustrated in Figure 11.21.

    Figure 11.21: Artificial Neuron Example--Adding Arrows
    Image neuron4.png

  6. Use Settings->Styles... to open the current styles selector, and set the font family to "Serif" and press Okay. Select the text tool , and add in the text, as illustrated in Figure 11.22.

    Figure 11.22: Artificial Neuron Example--Adding Text
    Image neuron5.png

    If you want to include your image into a LaTeX document as a pgfpicture environment, it would look better if you put the text into maths mode, and use subscripts. To do this first select the , and then select Edit->Text->Edit text.... This will open up the edit text dialog box. Click on the Different button, and enter the text as it should be in the LaTeX file (Figure 11.23.) Do this for each . In addition, select all of the text on the left ("x1", "x2" and "xn") and use the Edit->Text->Font Style->All Styles... dialog box to change the horizontal anchor parameter to Right. (Note that you will not see any difference to the image in Jpgfdraw.)

    Figure 11.23: Artificial Neuron Example--Editing Text
    Image neuron6.png

  7. Select the text tool and start a text area in the rectangle. I want to use a capital sigma to indicate a summation, and as I don't know the magic combination of characters to access that symbol, I used the Insert Symbol dialog box. To do this, either use the popup menu and select Insert Symbol..., or press the Ins key. The required symbol can now be selected from the dialog box (illustrated in Figure 11.24).

    Figure 11.24: Artificial Neuron Example--Insert Symbol Dialog Box
    Image neuron7.png

  8. Use the Edit->Text->Font Style->All Styles... to change the font size to 25 and change both the anchor settings to Centre, see Figure 11.25. (You don't need to change the anchor settings if you have the automatic anchor update setting enabled, as it will change when you justify the in step 9.)

    Figure 11.25: Artificial Neuron Example--Setting the Font Style
    Image neuron8.png

    If you want to export your image into a LaTeX document, you will need to set the LaTeX equivalent text to $\Sigma$. As before, this is done by selecting the and using the Edit->Text->Edit text... menu item to open the Edit Text dialog box (Figure 11.26(b)).

    Figure 11.26: Artificial Neuron Example--setting the equivalent LaTeX symbol: (a) selected text; (b) setting LaTeX equivalent.
    Image neuron9a.png
    (a)
    Image neuron9b.png
    (b)

  9. The Sigma would look much better if it was centred inside the rectangle. To do this select the Sigma and the rectangle, then group them either by clicking on the group objects button or by using the Transform->Group menu item. Then select the Transform->Justify->Centre menu item, and then the Transform->Justify->Middle menu item. The should now be centred inside the rectangle (Figure 11.27).

    Figure 11.27: Artificial Neuron Example--Justifying Objects
    Image neuron10.png

    To include the image inside a LaTeX document, save the image to a LaTeX file using the File->Export... menu item, and then include it in your document (assuming the file was called neuron.tex):

    \begin{figure}
    \centering
    \input{neuron}
    \caption{An Artificial Neuron}
    \end{figure}
    
    (Remember to use the pgf package.) The image will appear in the LaTeX document as illustrated in Figure 11.28. (For best results use either PDFLaTeX or LaTeX and dvips as some dvi viewers may not be able to interpret the pgf specials.)

    Figure 11.28: Artificial Neuron Example--Image as it Appears in a LaTeX Document
    Image neuron.png


previous   Cheese and Lettuce onBus   next