Does ROOT support adding new Marker style now?

Hi all:
If I want to set marker style defined by myself,
like emoji or emoji?
could I set it using a icons?
:b:’, or ‘’

Hi,

I don’t think this is supported yet. Do you have an implementation plan in mind?

Best,
Danilo

Right now we have a large collection of marker’s styles listed here: ROOT: TAttMarker Class Reference . For some of them the line width can be changed, but there is nothing allowing to define your own marker style (as a emoji or as a special character). The best I can think of with the current ROOT functionality is to draw a character (using TText) centered horizontally and vertically (alignment 22) at the desired position. This will already offer a very large choice.

For instance:

#include <TPolyMarker.h>
#include <TText.h>

//////////////////////////////////////////////////////////////////////////////////////////
/// class TPolyMarkerText

class TPolyMarkerText :public TPolyMarker {
protected:
   TText  *fT;
   TString S;

public:
   TPolyMarkerText(Int_t font, TString t);
   void Draw(Option_t *option="") override;
   void Paint(Option_t *option="") override;
};


TPolyMarkerText::TPolyMarkerText(Int_t font, TString t)
      :TPolyMarker()
{
   fT = new TText();
   fT->SetTextFont(font);
   fT->SetTextAlign(22);
   S = t;
}

void TPolyMarkerText::Draw(Option_t *option)
{
   AppendPad(option);
}

void TPolyMarkerText::Paint(Option_t *option)
{
   for (int i=0; i<fLastPoint+1; i++) {
      fT->PaintText(fX[i], fY[i], S.Data());
   }
}

//////////////////////////////////////////////////////////////////////////////////////////
/// Test

void polytext() {
   auto pt = new TPolyMarkerText(142,"C");
   auto c = new TCanvas();
   c->DrawFrame(0., 0.,4.,4.);
   pt->SetPoint(0, 1., 1.);
   pt->SetPoint(1, 2., 2.);
   pt->SetPoint(2, 3., 3.);
   pt->Draw();
}

May be something similar can be made a ROOT class. Note it should be completed with the color, the size etc … also some variant can be imagined, like having a different Text at each position.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.