Plot()

Syntax

Plot(x, y [, Color])
Description
Draw a single pixel at the given location in the current output. The current output is set with StartDrawing().

Parameters

x, y The location of the pixel to set.

For performance reasons there are no bounds checks performed on these coordinates, the specified coordinates must be inside the current drawing area. OutputWidth() and OutputHeight() can be used to verify that. This command is also not affected by any clipping imposed by ClipOutput().
Color (optional) The color to be used for the pixel. If this parameter is not specified, the default color set with FrontColor() will be used. This color can be in RGB or RGBA format.

Return value

None.

Example

  If OpenWindow(0, 0, 0, 200, 200, "2DDrawing Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    If CreateImage(0, 200, 200) And StartDrawing(ImageOutput(0))
      For x = 0 To 199
        For y = 0 To 199
          Plot(x, y, RGB(Random(255), Random(255), Random(255)))
        Next y
      Next x
      StopDrawing() 
      ImageGadget(0, 0, 0, 200, 200, ImageID(0))
    EndIf
    
    Repeat
      Event = WaitWindowEvent()
    Until Event = #PB_Event_CloseWindow
  EndIf

See Also

Point(), FrontColor()

Supported OS

All

<- OutputWidth() - 2DDrawing Index - Point() ->