Setting anchors in RectTransform making panel appear to vanish

When using offsetMax and offsetMin to try and pin a panel to the top of the screen the panel appears to vanish

    RectTransform logopanel = _logoPanel.GetComponent<RectTransform>();
    logopanel.sizeDelta = new Vector2(_logoSprite.rect.width/8, _logoSprite.rect.height / 8);
    //logopanel.offsetMin = new Vector2(0.5f, 1.0f);
    //logopanel.offsetMax = new Vector2(0.5f, 1.0f);
    logopanel.pivot = new Vector2(0.5f, 1.0f);
    logopanel.position = new Vector3(0, 0, 0);

When I uncomment the two lines above my panel just appears to vanish, the anchor shows as being in the centre, middle on the anchor inspector and the object appears in the bottom left of the parent canvas not at 0,0,0.

It appears as if I am setting them like so in the inspector

 logopanel.offsetMin = new Vector2(0.5f, 0.5f);
 logopanel.offsetMax = new Vector2(0.5f, 0.5f);
 logopanel.pivot = new Vector2(0.5f, 1.0f);
 logopanel.position = new Vector3(-viewwidth/2, -viewheight/2, 0);

I’m genuinely puzzled by this as the Image in the panel also vanishes completely despite the Image component still existing and sprite being set correctly in the inspector.

If I comment those lines out the panel renders fine just the anchors are not where I want them.
According to what I’ve read this should work fine. Is there something obvious I’m missing?

I fixed it myself

I made a mistake with autocomplete

logopanel.anchorMin = new Vector2(0.5f, 1.0f);
logopanel.anchorMax = new Vector2(0.5f, 1.0f);

Is the correct way to handle this.